Skip to content

Commit 731ffb6

Browse files
committed
w
1 parent 0927cf9 commit 731ffb6

File tree

11 files changed

+762
-50
lines changed

11 files changed

+762
-50
lines changed

.cursor/rules/coding-style.mdc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ Coding style:
3030
- Alphabetize imports, group by source type (built-in/external/internal)
3131
- Favor US English over UK English, so `summarizeError` over `summarise Error`
3232
- Favor `.replaceAll('a', 'b)` over `.replace(/a/g, 'b')` or `.replace(new RegExp('a', 'g'), 'b')` when the only need for regeses was replacing all strings. That's usually both easier to read and more performant.
33+
- Use typographic characters: ellipsis (`…`) instead of `...`, curly quotes (`'` `"`) instead of straight quotes in user-facing text
34+
- Put API keys and secrets in `.env` files, not hardcoded in components
35+
- Check for existing hooks before creating new ones (e.g., `useUppy()` for Uppy functionality)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
"p-retry": "^7.0.0",
5151
"rimraf": "^6.1.2",
5252
"temp": "^0.9.4",
53-
"tsx": "4.20.5",
54-
"typescript": "5.9.2",
53+
"tsx": "4.21.0",
54+
"typescript": "5.9.3",
5555
"vitest": "^3.2.4"
5656
},
5757
"repository": {

src/alphalib/mcache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { SevLogger } from '@transloadit/sev-logger'
22
import type { Schema } from 'zod'
33

4-
export interface McacheOpts<T> {
4+
export interface McacheOpts {
55
ttlMs?: number
66
zodSchema?: Schema
77
logger?: SevLogger
@@ -37,10 +37,10 @@ interface CacheEntry<T> {
3737
*/
3838
export class Mcache<T> {
3939
#cache: Map<string, CacheEntry<T>>
40-
#opts: Required<Omit<McacheOpts<T>, 'logger' | 'zodSchema' | 'keyFn'>> &
41-
Pick<McacheOpts<T>, 'logger' | 'zodSchema' | 'keyFn'>
40+
#opts: Required<Omit<McacheOpts, 'logger' | 'zodSchema' | 'keyFn'>> &
41+
Pick<McacheOpts, 'logger' | 'zodSchema' | 'keyFn'>
4242

43-
constructor(opts: McacheOpts<T> = {}) {
43+
constructor(opts: McacheOpts = {}) {
4444
this.#cache = new Map()
4545
this.#opts = {
4646
ttlMs: opts.ttlMs ?? Number.POSITIVE_INFINITY,

src/alphalib/types/robots/_index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { z } from 'zod'
2-
2+
import {
3+
meta as aiChatMeta,
4+
interpolatableRobotAiChatInstructionsSchema,
5+
interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema,
6+
} from './ai-chat.ts'
37
import {
48
meta as audioArtworkMeta,
59
interpolatableRobotAudioArtworkInstructionsSchema,
@@ -474,6 +478,7 @@ const robotStepsInstructions = [
474478
interpolatableRobotSwiftStoreInstructionsSchema,
475479
interpolatableRobotTextSpeakInstructionsSchema,
476480
interpolatableRobotTextTranslateInstructionsSchema,
481+
interpolatableRobotAiChatInstructionsSchema,
477482
interpolatableRobotTigrisImportInstructionsSchema,
478483
interpolatableRobotTigrisStoreInstructionsSchema,
479484
interpolatableRobotTlcdnDeliverInstructionsSchema,
@@ -558,6 +563,7 @@ const robotStepsInstructionsWithHiddenFields = [
558563
interpolatableRobotSwiftStoreInstructionsWithHiddenFieldsSchema,
559564
interpolatableRobotTextSpeakInstructionsWithHiddenFieldsSchema,
560565
interpolatableRobotTextTranslateInstructionsWithHiddenFieldsSchema,
566+
interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema,
561567
interpolatableRobotTigrisImportInstructionsWithHiddenFieldsSchema,
562568
interpolatableRobotTigrisStoreInstructionsWithHiddenFieldsSchema,
563569
interpolatableRobotTlcdnDeliverInstructionsWithHiddenFieldsSchema,
@@ -605,6 +611,7 @@ export type RobotsWithHiddenBots = z.infer<typeof robotsWithHiddenBotsSchema>
605611
export type RobotsWithHiddenBotsAndFields = z.infer<typeof robotsWithHiddenBotsAndFieldsSchema>
606612

607613
export const robotsMeta = {
614+
aiChatMeta,
608615
audioArtworkMeta,
609616
audioConcatMeta,
610617
audioEncodeMeta,
@@ -687,6 +694,12 @@ export const robotsMeta = {
687694
youtubeStoreMeta,
688695
}
689696

697+
export type {
698+
InterpolatableRobotAiChatInstructions,
699+
InterpolatableRobotAiChatInstructionsInput,
700+
InterpolatableRobotAiChatInstructionsWithHiddenFields,
701+
InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput,
702+
} from './ai-chat.ts'
690703
export type {
691704
InterpolatableRobotAssemblySavejsonInstructions,
692705
InterpolatableRobotAssemblySavejsonInstructionsInput,

src/alphalib/types/robots/_instructions-primitives.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { z } from 'zod'
44
import { stackVersions } from '../stackVersions.ts'
55

66
export const robotNames = z.enum([
7+
'AiChatRobot',
78
'UploadHandleRobot',
89
'FileServeRobot',
910
'FileWatermarkRobot',
@@ -395,21 +396,18 @@ export function interpolateRecursive<Schema extends z.ZodFirstPartySchemaTypes>(
395396
*/
396397
const uninterpolatableKeys = ['robot', 'use'] as const
397398

398-
type InterpolatableRobot<Schema extends z.ZodObject<z.ZodRawShape>> = Schema extends z.ZodObject<
399-
infer T,
400-
infer UnknownKeys,
401-
infer Catchall
402-
>
403-
? z.ZodObject<
404-
{
405-
[Key in keyof T]: Key extends (typeof uninterpolatableKeys)[number]
406-
? T[Key]
407-
: InterpolatableSchema<T[Key]>
408-
},
409-
UnknownKeys,
410-
Catchall
411-
>
412-
: never
399+
type InterpolatableRobot<Schema extends z.ZodObject<z.ZodRawShape>> =
400+
Schema extends z.ZodObject<infer T, infer UnknownKeys, infer Catchall>
401+
? z.ZodObject<
402+
{
403+
[Key in keyof T]: Key extends (typeof uninterpolatableKeys)[number]
404+
? T[Key]
405+
: InterpolatableSchema<T[Key]>
406+
},
407+
UnknownKeys,
408+
Catchall
409+
>
410+
: never
413411

414412
export function interpolateRobot<Schema extends z.ZodObject<z.ZodRawShape>>(
415413
schema: Schema,
@@ -1762,3 +1760,11 @@ Delta to apply to segment duration. This is optional and allows fine-tuning of s
17621760
`),
17631761
})
17641762
.strict()
1763+
1764+
/**
1765+
* Type for the normalized use parameter from AssemblyNormalizer
1766+
* The steps array can contain either strings or objects with name property
1767+
*/
1768+
export interface NormalizedUse {
1769+
steps: Array<{ name: string; as?: string; fields?: string }>
1770+
}

0 commit comments

Comments
 (0)