@playcraft/common 0.1.83 → 0.1.85-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cloud-workspace/runtime/agent-opencode-gateway.d.ts +45 -2
- package/dist/cloud-workspace/runtime/agent-opencode-gateway.d.ts.map +1 -1
- package/dist/cloud-workspace/runtime/agent-opencode-gateway.js +51 -3
- package/dist/cloud-workspace/runtime/agent-opencode-gateway.js.map +1 -1
- package/dist/cloud-workspace/runtime/execution-grant.d.ts +19 -1
- package/dist/cloud-workspace/runtime/execution-grant.d.ts.map +1 -1
- package/dist/cloud-workspace/runtime/execution-grant.js +26 -2
- package/dist/cloud-workspace/runtime/execution-grant.js.map +1 -1
- package/dist/cloud-workspace/runtime/index.d.ts +7 -6
- package/dist/cloud-workspace/runtime/index.d.ts.map +1 -1
- package/dist/cloud-workspace/runtime/index.js +7 -6
- package/dist/cloud-workspace/runtime/index.js.map +1 -1
- package/dist/cloud-workspace/runtime/model-capture-upload-grant.d.ts +27 -0
- package/dist/cloud-workspace/runtime/model-capture-upload-grant.d.ts.map +1 -0
- package/dist/cloud-workspace/runtime/model-capture-upload-grant.js +51 -0
- package/dist/cloud-workspace/runtime/model-capture-upload-grant.js.map +1 -0
- package/dist/inspiration/catalog.d.ts +68 -0
- package/dist/inspiration/catalog.d.ts.map +1 -0
- package/dist/inspiration/catalog.js +98 -0
- package/dist/inspiration/catalog.js.map +1 -0
- package/dist/inspiration/collection.d.ts +35 -0
- package/dist/inspiration/collection.d.ts.map +1 -0
- package/dist/inspiration/collection.js +5 -0
- package/dist/inspiration/collection.js.map +1 -0
- package/dist/inspiration/index.d.ts +242 -0
- package/dist/inspiration/index.d.ts.map +1 -0
- package/dist/inspiration/index.js +154 -0
- package/dist/inspiration/index.js.map +1 -0
- package/dist/inspiration/vocabulary.d.ts +155 -0
- package/dist/inspiration/vocabulary.d.ts.map +1 -0
- package/dist/inspiration/vocabulary.js +43 -0
- package/dist/inspiration/vocabulary.js.map +1 -0
- package/dist/model-proxy/captures.d.ts +152 -0
- package/dist/model-proxy/captures.d.ts.map +1 -0
- package/dist/model-proxy/captures.js +64 -0
- package/dist/model-proxy/captures.js.map +1 -0
- package/dist/model-proxy/index.d.ts +1 -0
- package/dist/model-proxy/index.d.ts.map +1 -1
- package/dist/model-proxy/index.js +1 -0
- package/dist/model-proxy/index.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SignJWT, jwtVerify } from 'jose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { generationSchema, runtimeEpochSchema } from './generations.js';
|
|
4
|
+
export const MODEL_CAPTURE_UPLOAD_KIND = 'model-capture-upload-v1';
|
|
5
|
+
export const MODEL_CAPTURE_UPLOAD_AUDIENCE = 'workspace-model-capture-upload';
|
|
6
|
+
export const modelCaptureUploadGrantClaimsSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
kind: z.literal(MODEL_CAPTURE_UPLOAD_KIND),
|
|
9
|
+
aud: z.literal(MODEL_CAPTURE_UPLOAD_AUDIENCE),
|
|
10
|
+
grantId: z.string().min(1).max(128),
|
|
11
|
+
issuedAt: z.string().datetime(),
|
|
12
|
+
expiresAt: z.string().datetime(),
|
|
13
|
+
userId: z.string().min(1).max(128),
|
|
14
|
+
workspaceId: z.string().min(1).max(128),
|
|
15
|
+
environment: z.string().min(1).max(64),
|
|
16
|
+
runtimeId: z.string().min(1).max(128),
|
|
17
|
+
generation: generationSchema,
|
|
18
|
+
runtimeEpoch: runtimeEpochSchema,
|
|
19
|
+
sessionId: z.string().min(1).max(128),
|
|
20
|
+
clientRequestId: z.string().min(1).max(128),
|
|
21
|
+
runtimeOperationId: z.string().min(1).max(128),
|
|
22
|
+
directory: z.string().min(1).max(128),
|
|
23
|
+
modelCallId: z.string().min(1).max(128),
|
|
24
|
+
captureCallRowId: z.string().min(1).max(128),
|
|
25
|
+
allowedStages: z.tuple([z.literal('codex_request'), z.literal('codex_response')]),
|
|
26
|
+
})
|
|
27
|
+
.strict()
|
|
28
|
+
.refine((value) => Date.parse(value.expiresAt) > Date.parse(value.issuedAt) &&
|
|
29
|
+
Date.parse(value.expiresAt) - Date.parse(value.issuedAt) <= 5 * 60_000, 'capture_grant_lifetime');
|
|
30
|
+
export async function signModelCaptureUploadGrant(claims, secret) {
|
|
31
|
+
const parsed = modelCaptureUploadGrantClaimsSchema.parse(claims);
|
|
32
|
+
if (secret.length < 16)
|
|
33
|
+
throw new Error('grant_secret_required');
|
|
34
|
+
return new SignJWT(parsed)
|
|
35
|
+
.setProtectedHeader({ alg: 'HS256' })
|
|
36
|
+
.setIssuedAt(Math.floor(Date.parse(parsed.issuedAt) / 1000))
|
|
37
|
+
.setExpirationTime(Math.floor(Date.parse(parsed.expiresAt) / 1000))
|
|
38
|
+
.setJti(parsed.grantId)
|
|
39
|
+
.sign(new TextEncoder().encode(secret));
|
|
40
|
+
}
|
|
41
|
+
export async function verifyModelCaptureUploadGrant(token, secret) {
|
|
42
|
+
if (secret.length < 16)
|
|
43
|
+
throw new Error('grant_secret_required');
|
|
44
|
+
const { payload } = await jwtVerify(token, new TextEncoder().encode(secret), {
|
|
45
|
+
algorithms: ['HS256'],
|
|
46
|
+
audience: MODEL_CAPTURE_UPLOAD_AUDIENCE,
|
|
47
|
+
});
|
|
48
|
+
const { iat: _iat, exp: _exp, jti: _jti, ...claims } = payload;
|
|
49
|
+
return modelCaptureUploadGrantClaimsSchema.parse(claims);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=model-capture-upload-grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-capture-upload-grant.js","sourceRoot":"","sources":["../../../src/cloud-workspace/runtime/model-capture-upload-grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO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AAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;SAC3D,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;SAClE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;SACtB,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,KAAa,EACb,MAAc;IAEd,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACjE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QAC3E,UAAU,EAAE,CAAC,OAAO,CAAC;QACrB,QAAQ,EAAE,6BAA6B;KACxC,CAAC,CAAC;IACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IAC/D,OAAO,mCAAmC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const INSPIRATION_MAX_ACTIVE_GAMES = 5000;
|
|
3
|
+
export declare const inspirationBusinessInputSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export declare const inspirationGameInputSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
businessIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export declare const inspirationGameUpdateSchema: z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
businessIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
13
|
+
rename: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
action: z.ZodEnum<{
|
|
15
|
+
correct: "correct";
|
|
16
|
+
new: "new";
|
|
17
|
+
}>;
|
|
18
|
+
previousName: z.ZodString;
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type InspirationGameUpdate = z.infer<typeof inspirationGameUpdateSchema>;
|
|
22
|
+
export type InspirationNameCheck = {
|
|
23
|
+
status: 'matched' | 'empty' | 'failed' | 'unconfigured';
|
|
24
|
+
sampleCount: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const inspirationCatalogSchema: z.ZodObject<{
|
|
27
|
+
businesses: z.ZodArray<z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
games: z.ZodArray<z.ZodObject<{
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
businessIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
archivedAt: z.ZodOptional<z.ZodString>;
|
|
36
|
+
resumeRequestedAt: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type InspirationCatalog = z.infer<typeof inspirationCatalogSchema>;
|
|
40
|
+
export type InspirationBusinessInput = z.infer<typeof inspirationBusinessInputSchema>;
|
|
41
|
+
export type InspirationGameInput = z.infer<typeof inspirationGameInputSchema>;
|
|
42
|
+
export type InspirationGame = InspirationCatalog['games'][number];
|
|
43
|
+
export declare const inspirationGameImportSchema: z.ZodObject<{
|
|
44
|
+
games: z.ZodArray<z.ZodObject<{
|
|
45
|
+
id: z.ZodOptional<z.ZodString>;
|
|
46
|
+
previousName: z.ZodOptional<z.ZodString>;
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
businessNames: z.ZodArray<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export type InspirationGameImport = z.infer<typeof inspirationGameImportSchema>;
|
|
52
|
+
export declare const inspirationTeamVisibilitySchema: z.ZodObject<{
|
|
53
|
+
mode: z.ZodEnum<{
|
|
54
|
+
none: "none";
|
|
55
|
+
all: "all";
|
|
56
|
+
selected: "selected";
|
|
57
|
+
}>;
|
|
58
|
+
businessIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
|
+
gameIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export type InspirationTeamVisibility = z.infer<typeof inspirationTeamVisibilitySchema>;
|
|
62
|
+
export type InspirationTeamSettings = {
|
|
63
|
+
visibility: InspirationTeamVisibility;
|
|
64
|
+
catalog: InspirationCatalog;
|
|
65
|
+
};
|
|
66
|
+
export declare function visibleInspirationGames(catalog: InspirationCatalog, visibility: InspirationTeamVisibility): InspirationGame[];
|
|
67
|
+
export declare function normalizeInspirationVisibility(catalog: InspirationCatalog, value: InspirationTeamVisibility): InspirationTeamVisibility;
|
|
68
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/inspiration/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAGjD,eAAO,MAAM,8BAA8B;;kBAEhC,CAAC;AACZ,eAAO,MAAM,0BAA0B;;;kBAK5B,CAAC;AACZ,eAAO,MAAM,2BAA2B;;;;;;;;;;kBAQtC,CAAC;AACH,MAAM,M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
2
|
+
export const INSPIRATION_MAX_ACTIVE_GAMES = 5000;
|
|
3
|
+
const id = z.string().regex(/^[a-zA-Z0-9_-]{1,128}$/);
|
|
4
|
+
export const inspirationBusinessInputSchema = z
|
|
5
|
+
.object({ name: z.string().trim().min(1).max(100) })
|
|
6
|
+
.strict();
|
|
7
|
+
export const inspirationGameInputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
name: z.string().trim().min(1).max(200),
|
|
10
|
+
businessIds: z.array(id).max(100).default([]),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
export const inspirationGameUpdateSchema = inspirationGameInputSchema.extend({
|
|
14
|
+
rename: z
|
|
15
|
+
.object({
|
|
16
|
+
action: z.enum(['correct', 'new']),
|
|
17
|
+
previousName: z.string().trim().min(1).max(200),
|
|
18
|
+
})
|
|
19
|
+
.strict()
|
|
20
|
+
.optional(),
|
|
21
|
+
});
|
|
22
|
+
export const inspirationCatalogSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
businesses: z.array(inspirationBusinessInputSchema.extend({ id })).max(100),
|
|
25
|
+
games: z.array(inspirationGameInputSchema.extend({
|
|
26
|
+
id,
|
|
27
|
+
archivedAt: z.string().datetime().optional(),
|
|
28
|
+
resumeRequestedAt: z.string().datetime().optional(),
|
|
29
|
+
})),
|
|
30
|
+
})
|
|
31
|
+
.strict()
|
|
32
|
+
.superRefine((catalog, ctx) => {
|
|
33
|
+
if (catalog.games.filter((game) => !game.archivedAt).length > INSPIRATION_MAX_ACTIVE_GAMES)
|
|
34
|
+
ctx.addIssue({ code: 'custom', path: ['games'], message: 'inspiration_gameLimitReached' });
|
|
35
|
+
const businesses = new Set(catalog.businesses.map((business) => business.id));
|
|
36
|
+
const games = new Set(catalog.games.map((game) => game.id));
|
|
37
|
+
const names = catalog.games.map((game) => game.name);
|
|
38
|
+
if (businesses.size !== catalog.businesses.length ||
|
|
39
|
+
games.size !== catalog.games.length ||
|
|
40
|
+
new Set(names).size !== names.length ||
|
|
41
|
+
catalog.games.some((game) => game.businessIds.some((business) => !businesses.has(business))))
|
|
42
|
+
ctx.addIssue({ code: 'custom', message: 'inspiration_catalog_invalid' });
|
|
43
|
+
});
|
|
44
|
+
export const inspirationGameImportSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
games: z
|
|
47
|
+
.array(z
|
|
48
|
+
.object({
|
|
49
|
+
id: id.optional(),
|
|
50
|
+
previousName: z.string().trim().min(1).max(200).optional(),
|
|
51
|
+
name: z.string().trim().min(1).max(200),
|
|
52
|
+
businessNames: z.array(z.string().trim().min(1).max(100)).max(100),
|
|
53
|
+
})
|
|
54
|
+
.strict()
|
|
55
|
+
.refine((game) => Boolean(game.id) === Boolean(game.previousName)))
|
|
56
|
+
.min(1)
|
|
57
|
+
.max(5000),
|
|
58
|
+
})
|
|
59
|
+
.strict()
|
|
60
|
+
.superRefine(({ games }, ctx) => {
|
|
61
|
+
const names = new Set(games.map((game) => game.name));
|
|
62
|
+
const ids = games.flatMap((game) => (game.id ? [game.id] : []));
|
|
63
|
+
if (names.size !== games.length || new Set(ids).size !== ids.length)
|
|
64
|
+
ctx.addIssue({ code: 'custom', message: 'inspiration_import_duplicate' });
|
|
65
|
+
});
|
|
66
|
+
export const inspirationTeamVisibilitySchema = z
|
|
67
|
+
.object({
|
|
68
|
+
mode: z.enum(['all', 'selected', 'none']),
|
|
69
|
+
businessIds: z.array(id).max(100).default([]),
|
|
70
|
+
gameIds: z.array(id).default([]),
|
|
71
|
+
})
|
|
72
|
+
.strict()
|
|
73
|
+
.refine((value) => value.mode === 'selected'
|
|
74
|
+
? value.businessIds.length + value.gameIds.length > 0
|
|
75
|
+
: value.businessIds.length + value.gameIds.length === 0);
|
|
76
|
+
export function visibleInspirationGames(catalog, visibility) {
|
|
77
|
+
const businesses = new Set(catalog.businesses.map((business) => business.id));
|
|
78
|
+
return catalog.games.filter((game) => {
|
|
79
|
+
if (game.archivedAt || visibility.mode === 'none')
|
|
80
|
+
return false;
|
|
81
|
+
if (visibility.mode === 'all')
|
|
82
|
+
return true;
|
|
83
|
+
return (visibility.gameIds.includes(game.id) ||
|
|
84
|
+
game.businessIds.some((business) => businesses.has(business) && visibility.businessIds.includes(business)));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function normalizeInspirationVisibility(catalog, value) {
|
|
88
|
+
if (value.mode !== 'selected')
|
|
89
|
+
return { mode: value.mode, businessIds: [], gameIds: [] };
|
|
90
|
+
const businessIds = [...new Set(value.businessIds)]
|
|
91
|
+
.filter((id) => catalog.businesses.some((business) => business.id === id))
|
|
92
|
+
.sort();
|
|
93
|
+
const gameIds = [...new Set(value.gameIds)]
|
|
94
|
+
.filter((id) => catalog.games.some((game) => game.id === id && !game.businessIds.some((business) => businessIds.includes(business))))
|
|
95
|
+
.sort();
|
|
96
|
+
return { mode: businessIds.length || gameIds.length ? 'selected' : 'none', businessIds, gameIds };
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/inspiration/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC;KAC5C,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;KACnD,MAAM,EAAE,CAAC;AACZ,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,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C,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const inspirationCollectionFilterSchema: z.ZodDefault<z.ZodEnum<{
|
|
3
|
+
all: "all";
|
|
4
|
+
complete: "complete";
|
|
5
|
+
incomplete: "incomplete";
|
|
6
|
+
}>>;
|
|
7
|
+
export type InspirationCollectionFilter = z.infer<typeof inspirationCollectionFilterSchema>;
|
|
8
|
+
export type InspirationCollectionMode = 'backfill' | 'daily' | 'refresh';
|
|
9
|
+
export type InspirationCollectionProgress = {
|
|
10
|
+
id: string;
|
|
11
|
+
gameId: string;
|
|
12
|
+
gameName: string;
|
|
13
|
+
kind: 'playable' | 'video';
|
|
14
|
+
mode: InspirationCollectionMode;
|
|
15
|
+
status: 'queued' | 'running' | 'retrying' | 'complete' | 'failed';
|
|
16
|
+
nextPage: number;
|
|
17
|
+
pageSize: number;
|
|
18
|
+
total: number | null;
|
|
19
|
+
savedCount: number;
|
|
20
|
+
rangeStart: string;
|
|
21
|
+
rangeEnd: string;
|
|
22
|
+
nextAttemptAt: string;
|
|
23
|
+
completedAt: string | null;
|
|
24
|
+
errorCode: string | null;
|
|
25
|
+
};
|
|
26
|
+
export type InspirationCollectionFeed = {
|
|
27
|
+
items: InspirationCollectionProgress[];
|
|
28
|
+
total: number;
|
|
29
|
+
page: number;
|
|
30
|
+
pageSize: number;
|
|
31
|
+
environment: string;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
failedCount?: number;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/inspiration/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iCAAiC;;;;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C;KAC/C,IAAI,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;KACvC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export * from './vocabulary.js';
|
|
3
|
+
export declare const INSPIRATION_ANALYSIS_VERSION = "inspiration-analysis.v1";
|
|
4
|
+
export declare const tagDimensions: readonly ["hook", "psychology", "mechanic", "interaction", "visual", "conversion", "narrative", "pacing"];
|
|
5
|
+
export declare const playableDimensions: readonly ["hook", "psychology", "mechanic", "interaction", "visual", "conversion"];
|
|
6
|
+
export declare const videoDimensions: readonly ["hook", "psychology", "mechanic", "narrative", "visual", "conversion", "pacing"];
|
|
7
|
+
export declare const inspirationKindSchema: z.ZodEnum<{
|
|
8
|
+
video: "video";
|
|
9
|
+
playable: "playable";
|
|
10
|
+
}>;
|
|
11
|
+
export type InspirationKind = z.infer<typeof inspirationKindSchema>;
|
|
12
|
+
export * from './catalog.js';
|
|
13
|
+
export * from './collection.js';
|
|
14
|
+
export declare const inspirationAnalysisSchema: z.ZodObject<{
|
|
15
|
+
summary: z.ZodString;
|
|
16
|
+
hookType: z.ZodEnum<{
|
|
17
|
+
unknown: "unknown";
|
|
18
|
+
playable: "playable";
|
|
19
|
+
video_then_playable: "video_then_playable";
|
|
20
|
+
end_card: "end_card";
|
|
21
|
+
}>;
|
|
22
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
23
|
+
dimension: z.ZodEnum<{
|
|
24
|
+
interaction: "interaction";
|
|
25
|
+
visual: "visual";
|
|
26
|
+
conversion: "conversion";
|
|
27
|
+
pacing: "pacing";
|
|
28
|
+
hook: "hook";
|
|
29
|
+
psychology: "psychology";
|
|
30
|
+
mechanic: "mechanic";
|
|
31
|
+
narrative: "narrative";
|
|
32
|
+
}>;
|
|
33
|
+
value: z.ZodString;
|
|
34
|
+
confidence: z.ZodNumber;
|
|
35
|
+
}, z.core.$strict>>;
|
|
36
|
+
breakdown: z.ZodArray<z.ZodObject<{
|
|
37
|
+
dimension: z.ZodEnum<{
|
|
38
|
+
interaction: "interaction";
|
|
39
|
+
visual: "visual";
|
|
40
|
+
conversion: "conversion";
|
|
41
|
+
pacing: "pacing";
|
|
42
|
+
hook: "hook";
|
|
43
|
+
psychology: "psychology";
|
|
44
|
+
mechanic: "mechanic";
|
|
45
|
+
narrative: "narrative";
|
|
46
|
+
}>;
|
|
47
|
+
text: z.ZodString;
|
|
48
|
+
basis: z.ZodEnum<{
|
|
49
|
+
unknown: "unknown";
|
|
50
|
+
inferred: "inferred";
|
|
51
|
+
observed: "observed";
|
|
52
|
+
}>;
|
|
53
|
+
evidence: z.ZodArray<z.ZodString>;
|
|
54
|
+
confidence: z.ZodNumber;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>;
|
|
58
|
+
export declare const bilingualInspirationAnalysisSchema: z.ZodObject<{
|
|
59
|
+
schemaVersion: z.ZodLiteral<"inspiration-analysis.v2">;
|
|
60
|
+
summary: z.ZodObject<{
|
|
61
|
+
zh: z.ZodString;
|
|
62
|
+
en: z.ZodString;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
hookType: z.ZodEnum<{
|
|
65
|
+
unknown: "unknown";
|
|
66
|
+
video_hook: "video_hook";
|
|
67
|
+
image_hook: "image_hook";
|
|
68
|
+
gameplay_only: "gameplay_only";
|
|
69
|
+
}>;
|
|
70
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
71
|
+
dimension: z.ZodEnum<{
|
|
72
|
+
background: "background";
|
|
73
|
+
layout: "layout";
|
|
74
|
+
gameplay: "gameplay";
|
|
75
|
+
visual: "visual";
|
|
76
|
+
packaging: "packaging";
|
|
77
|
+
cta: "cta";
|
|
78
|
+
emotion: "emotion";
|
|
79
|
+
hook: "hook";
|
|
80
|
+
}>;
|
|
81
|
+
key: z.ZodEnum<{
|
|
82
|
+
action: "action";
|
|
83
|
+
interrupted: "interrupted";
|
|
84
|
+
puzzle: "puzzle";
|
|
85
|
+
billiards: "billiards";
|
|
86
|
+
tension: "tension";
|
|
87
|
+
end_card: "end_card";
|
|
88
|
+
video_hook: "video_hook";
|
|
89
|
+
image_hook: "image_hook";
|
|
90
|
+
gameplay_only: "gameplay_only";
|
|
91
|
+
matching: "matching";
|
|
92
|
+
simulation: "simulation";
|
|
93
|
+
flat_board: "flat_board";
|
|
94
|
+
stacked: "stacked";
|
|
95
|
+
full_screen: "full_screen";
|
|
96
|
+
split_screen: "split_screen";
|
|
97
|
+
gameplay_showcase: "gameplay_showcase";
|
|
98
|
+
fail_bait: "fail_bait";
|
|
99
|
+
challenge: "challenge";
|
|
100
|
+
story: "story";
|
|
101
|
+
indoor: "indoor";
|
|
102
|
+
outdoor: "outdoor";
|
|
103
|
+
abstract: "abstract";
|
|
104
|
+
rescue: "rescue";
|
|
105
|
+
warmth: "warmth";
|
|
106
|
+
satisfaction: "satisfaction";
|
|
107
|
+
cartoon: "cartoon";
|
|
108
|
+
realistic: "realistic";
|
|
109
|
+
minimal: "minimal";
|
|
110
|
+
pixel: "pixel";
|
|
111
|
+
install_button: "install_button";
|
|
112
|
+
}>;
|
|
113
|
+
confidence: z.ZodNumber;
|
|
114
|
+
}, z.core.$strict>>;
|
|
115
|
+
breakdown: z.ZodArray<z.ZodObject<{
|
|
116
|
+
dimension: z.ZodEnum<{
|
|
117
|
+
interaction: "interaction";
|
|
118
|
+
visual: "visual";
|
|
119
|
+
conversion: "conversion";
|
|
120
|
+
pacing: "pacing";
|
|
121
|
+
hook: "hook";
|
|
122
|
+
psychology: "psychology";
|
|
123
|
+
mechanic: "mechanic";
|
|
124
|
+
narrative: "narrative";
|
|
125
|
+
}>;
|
|
126
|
+
basis: z.ZodEnum<{
|
|
127
|
+
unknown: "unknown";
|
|
128
|
+
inferred: "inferred";
|
|
129
|
+
observed: "observed";
|
|
130
|
+
}>;
|
|
131
|
+
confidence: z.ZodNumber;
|
|
132
|
+
text: z.ZodObject<{
|
|
133
|
+
zh: z.ZodString;
|
|
134
|
+
en: z.ZodString;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
137
|
+
zh: z.ZodString;
|
|
138
|
+
en: z.ZodString;
|
|
139
|
+
}, z.core.$strict>>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
limitations: z.ZodArray<z.ZodObject<{
|
|
142
|
+
zh: z.ZodString;
|
|
143
|
+
en: z.ZodString;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
export type BilingualInspirationAnalysis = z.infer<typeof bilingualInspirationAnalysisSchema>;
|
|
147
|
+
export type InspirationAnalysis = z.infer<typeof inspirationAnalysisSchema> | BilingualInspirationAnalysis;
|
|
148
|
+
export declare function inspirationText(value: string | {
|
|
149
|
+
zh: string;
|
|
150
|
+
en: string;
|
|
151
|
+
}, locale: string): string;
|
|
152
|
+
export declare function inspirationTagLabel(tag: InspirationAnalysis['tags'][number], locale: string): string;
|
|
153
|
+
export declare function inspirationHookType(result?: InspirationAnalysis): BilingualInspirationAnalysis['hookType'];
|
|
154
|
+
export declare function validateInspirationAnalysis(value: unknown, kind: InspirationKind): InspirationAnalysis;
|
|
155
|
+
export declare function validateBilingualInspirationAnalysis(value: unknown, kind: InspirationKind): BilingualInspirationAnalysis;
|
|
156
|
+
export type InspirationMedia = {
|
|
157
|
+
coverUrl: string | null;
|
|
158
|
+
playableUrl: string | null;
|
|
159
|
+
videoUrl: string | null;
|
|
160
|
+
imageUrls: string[];
|
|
161
|
+
};
|
|
162
|
+
export type InspirationItem = {
|
|
163
|
+
id: string;
|
|
164
|
+
gameName: string;
|
|
165
|
+
gameIconUrl?: string | null;
|
|
166
|
+
developer?: string | null;
|
|
167
|
+
category?: string | null;
|
|
168
|
+
kind: InspirationKind;
|
|
169
|
+
title: string;
|
|
170
|
+
media: InspirationMedia;
|
|
171
|
+
contentVersion: string;
|
|
172
|
+
firstSeen: string | null;
|
|
173
|
+
lastSeen: string | null;
|
|
174
|
+
impressions: number | null;
|
|
175
|
+
activeDays: number | null;
|
|
176
|
+
channels: string[];
|
|
177
|
+
countries: string[];
|
|
178
|
+
analysis: {
|
|
179
|
+
version: string;
|
|
180
|
+
result: InspirationAnalysis;
|
|
181
|
+
} | null;
|
|
182
|
+
analysisMediaUpdated?: boolean;
|
|
183
|
+
analysisStatus: 'pending' | 'ready' | 'awaiting_evidence' | 'failed' | 'unknown' | 'blocked';
|
|
184
|
+
};
|
|
185
|
+
export type InspirationConfigurationIssue = 'analysisIdentityMissing' | 'sourceKeyMissing' | 'sourceConfigInvalid' | 'noCatalogGames' | 'noVisibleGames';
|
|
186
|
+
export type InspirationSyncResult = {
|
|
187
|
+
status: 'started' | 'running';
|
|
188
|
+
} | {
|
|
189
|
+
status: 'unconfigured';
|
|
190
|
+
configurationIssue?: InspirationConfigurationIssue;
|
|
191
|
+
};
|
|
192
|
+
export type InspirationFeed = {
|
|
193
|
+
syncNextRunAt?: string | null;
|
|
194
|
+
status: 'unconfigured' | 'ready';
|
|
195
|
+
configurationIssue?: InspirationConfigurationIssue;
|
|
196
|
+
configVersion: string;
|
|
197
|
+
items: InspirationItem[];
|
|
198
|
+
total: number;
|
|
199
|
+
page: number;
|
|
200
|
+
pageSize: number;
|
|
201
|
+
facets: {
|
|
202
|
+
games: {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
}[];
|
|
206
|
+
channels: string[];
|
|
207
|
+
countries: string[];
|
|
208
|
+
};
|
|
209
|
+
lastSuccessAt: string | null;
|
|
210
|
+
syncStatus: 'pending' | 'running' | 'complete' | 'partial' | 'failed';
|
|
211
|
+
coverage: 'pending' | 'complete' | 'partial';
|
|
212
|
+
};
|
|
213
|
+
export declare const inspirationFiltersSchema: z.ZodObject<{
|
|
214
|
+
kind: z.ZodDefault<z.ZodEnum<{
|
|
215
|
+
video: "video";
|
|
216
|
+
playable: "playable";
|
|
217
|
+
}>>;
|
|
218
|
+
days: z.ZodDefault<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>>>;
|
|
219
|
+
sort: z.ZodDefault<z.ZodEnum<{
|
|
220
|
+
impressions: "impressions";
|
|
221
|
+
newest: "newest";
|
|
222
|
+
activeDays: "activeDays";
|
|
223
|
+
}>>;
|
|
224
|
+
games: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
225
|
+
channels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
226
|
+
countries: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
227
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
228
|
+
}, z.core.$strict>;
|
|
229
|
+
export type InspirationFilters = z.infer<typeof inspirationFiltersSchema>;
|
|
230
|
+
export declare const inspirationHandoffSchema: z.ZodObject<{
|
|
231
|
+
schemaVersion: z.ZodLiteral<"inspiration-handoff.v1">;
|
|
232
|
+
inspirationId: z.ZodString;
|
|
233
|
+
analysisVersion: z.ZodString;
|
|
234
|
+
sourceTeamId: z.ZodString;
|
|
235
|
+
entrySource: z.ZodEnum<{
|
|
236
|
+
list: "list";
|
|
237
|
+
share: "share";
|
|
238
|
+
}>;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
export type InspirationHandoff = z.infer<typeof inspirationHandoffSchema>;
|
|
241
|
+
export declare function buildInspirationHandoffUrl(reference: InspirationHandoff): string;
|
|
242
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inspiration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,cAAc,iBAAiB,CAAC;AAEhC,eAAO,MAAM,4BAA4B,4BAA4B,C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