@vgai/sdk 0.5.4 → 0.5.6

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/sdk",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.4",
5
+ "version": "0.5.6",
6
6
  "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
@@ -18,16 +18,19 @@
18
18
  "exports": {
19
19
  ".": "./src/index.ts",
20
20
  "./account": "./src/account.ts",
21
+ "./build-discipline": "./src/project/build-discipline.ts",
21
22
  "./generations": "./src/generations.ts",
22
23
  "./mcp-stdio": "./src/mcp/mcp-stdio-server.ts",
23
24
  "./project-tool-catalog": "./src/project-tool-catalog.ts",
24
25
  "./project-inspection-node": "./src/project/inspection-node.ts",
25
26
  "./registry": "./src/registry.ts",
27
+ "./run-name": "./src/project/run-name.ts",
28
+ "./session-journal": "./src/project/session-journal.ts",
26
29
  "./tools": "./src/tools.ts"
27
30
  },
28
31
  "dependencies": {
29
32
  "@modelcontextprotocol/sdk": "^1.30.0",
30
- "@vgai/engine": "0.5.4",
33
+ "@vgai/engine": "0.5.6",
31
34
  "playwright": "^1.58.2",
32
35
  "zod": "^4.3.6"
33
36
  }
package/src/account.ts CHANGED
@@ -32,6 +32,13 @@ export const AccountSpendPolicySchema = z.object({
32
32
  })
33
33
  .optional(),
34
34
  });
35
+ export const AccountAlertSchema = z.object({
36
+ id: z.string().min(1),
37
+ kind: z.enum(['threshold', 'auto_reload_succeeded', 'auto_reload_failed']),
38
+ message: z.string().min(1),
39
+ createdAt: z.string().datetime(),
40
+ readAt: z.string().datetime().optional(),
41
+ });
35
42
  export const AccountUserSchema = z.object({
36
43
  id: z.string().min(1),
37
44
  email: z.string().email(),
@@ -57,13 +64,46 @@ export const AccountOrganizationSchema = z.object({
57
64
  export const AccountUsageEntrySchema = z.object({
58
65
  id: z.string().min(1),
59
66
  occurredAt: z.string().datetime(),
60
- kind: z.literal('generation'),
67
+ kind: z.enum(['inference', 'generation', 'workspace', 'storage', 'relay', 'deployment']),
61
68
  provider: z.string().min(1),
62
69
  operation: z.string().optional(),
63
70
  credits: z.number().nonnegative(),
64
71
  state: z.enum(['reserved', 'settled', 'released']),
65
72
  externalId: z.string().optional(),
66
73
  });
74
+ export const AccountPlanIdSchema = z.enum(['free', 'creator', 'max', 'ultra']);
75
+ export const AccountCatalogSchema = z.object({
76
+ plans: z.object({
77
+ free: z.object({
78
+ name: z.string().min(1),
79
+ includedCredits: z.number().int().nonnegative(),
80
+ monthlyPriceUsd: z.number().nonnegative().optional(),
81
+ }),
82
+ creator: z.object({
83
+ name: z.string().min(1),
84
+ includedCredits: z.number().int().nonnegative(),
85
+ monthlyPriceUsd: z.number().nonnegative().optional(),
86
+ }),
87
+ max: z.object({
88
+ name: z.string().min(1),
89
+ includedCredits: z.number().int().nonnegative(),
90
+ monthlyPriceUsd: z.number().nonnegative().optional(),
91
+ }),
92
+ ultra: z.object({
93
+ name: z.string().min(1),
94
+ includedCredits: z.number().int().nonnegative(),
95
+ monthlyPriceUsd: z.number().nonnegative().optional(),
96
+ }),
97
+ }),
98
+ creditPacks: z.record(
99
+ z.string().min(1),
100
+ z.object({
101
+ name: z.string().min(1),
102
+ credits: z.number().int().positive(),
103
+ expiresInDays: z.number().int().positive().optional(),
104
+ }),
105
+ ),
106
+ });
67
107
  export const AccountSnapshotSchema = z.discriminatedUnion('authenticated', [
68
108
  z.object({ authenticated: z.literal(false), backend: AccountBackendSchema }),
69
109
  z.object({
@@ -74,6 +114,7 @@ export const AccountSnapshotSchema = z.discriminatedUnion('authenticated', [
74
114
  plan: AccountPlanSchema,
75
115
  credits: AccountCreditsSchema,
76
116
  spendPolicy: AccountSpendPolicySchema,
117
+ alerts: z.array(AccountAlertSchema).max(100).optional(),
77
118
  entitlements: z.object({
78
119
  generation: z.boolean(),
79
120
  dailyJobs: z.number().int().positive().optional(),
@@ -83,7 +124,12 @@ export const AccountSnapshotSchema = z.discriminatedUnion('authenticated', [
83
124
  /** Product-facing routes. Provider tools may translate BYOK to their native
84
125
  * transport name (`direct`) internally. */
85
126
  export const GenerationExecutionRouteSchema = z.enum(['mock', 'managed', 'byok']);
86
- export const ProviderCredentialIdSchema = z.enum(['fal', 'tripo', 'worldlabs']);
127
+ export const ProviderCredentialIdSchema = z.enum(['fal', 'tripo', 'worldlabs', 'openrouter']);
128
+ export const CodingInferenceSettingsSchema = z.object({
129
+ enabled: z.boolean(),
130
+ provider: z.literal('openrouter'),
131
+ model: z.string().trim().min(1).max(256),
132
+ });
87
133
  export const ProviderCredentialSourceSchema = z.enum(['environment', 'system', 'session', 'none']);
88
134
  export const ProviderCredentialStatusSchema = z.object({
89
135
  provider: ProviderCredentialIdSchema,
@@ -106,21 +152,29 @@ export type AccountBackend = z.infer<typeof AccountBackendSchema>;
106
152
  export type AccountPlan = z.infer<typeof AccountPlanSchema>;
107
153
  export type AccountCredits = z.infer<typeof AccountCreditsSchema>;
108
154
  export type AccountSpendPolicy = z.infer<typeof AccountSpendPolicySchema>;
155
+ export type AccountAlert = z.infer<typeof AccountAlertSchema>;
109
156
  export type AccountUser = z.infer<typeof AccountUserSchema>;
110
157
  export type AccountOrganization = z.infer<typeof AccountOrganizationSchema>;
111
158
  export type AccountOrganizationDomain = z.infer<typeof AccountOrganizationDomainSchema>;
112
159
  export type AccountUsageEntry = z.infer<typeof AccountUsageEntrySchema>;
160
+ export type AccountPlanId = z.infer<typeof AccountPlanIdSchema>;
161
+ export type AccountCatalog = z.infer<typeof AccountCatalogSchema>;
113
162
  export type AccountSnapshot = z.infer<typeof AccountSnapshotSchema>;
114
163
  export type GenerationExecutionRoute = z.infer<typeof GenerationExecutionRouteSchema>;
164
+ export type CodingInferenceSettings = z.infer<typeof CodingInferenceSettingsSchema>;
115
165
  export type ProviderCredentialId = z.infer<typeof ProviderCredentialIdSchema>;
116
166
  export type ProviderCredentialSource = z.infer<typeof ProviderCredentialSourceSchema>;
117
167
  export type ProviderCredentialStatus = z.infer<typeof ProviderCredentialStatusSchema>;
118
168
  export type ProviderCredentialTestResult = z.infer<typeof ProviderCredentialTestResultSchema>;
119
169
  export type EditorAccountSnapshot = AccountSnapshot & {
170
+ /** Which identity/payment surface backs this editor session. The in-process
171
+ * mock value exists only for isolated unit tests. */
172
+ accountEnvironment: 'test-mock' | 'development-twin' | 'production';
120
173
  routes: { mock: true; managed: boolean; byok: boolean; byokProviders: string[] };
121
174
  preferredRoute: GenerationExecutionRoute;
122
175
  /** Editor-only metadata. Credential values never cross the server boundary. */
123
176
  providerCredentials: ProviderCredentialStatus[];
177
+ codingInference: CodingInferenceSettings;
124
178
  };
125
179
  export interface GenerationAccountProjection {
126
180
  routes: EditorAccountSnapshot['routes'];
@@ -142,6 +196,7 @@ export function generationAccountProjection(
142
196
  export const EditorAccountSnapshotSchema: z.ZodType<EditorAccountSnapshot> = z.intersection(
143
197
  AccountSnapshotSchema,
144
198
  z.object({
199
+ accountEnvironment: z.enum(['test-mock', 'development-twin', 'production']),
145
200
  routes: z.object({
146
201
  mock: z.literal(true),
147
202
  managed: z.boolean(),
@@ -150,5 +205,6 @@ export const EditorAccountSnapshotSchema: z.ZodType<EditorAccountSnapshot> = z.i
150
205
  }),
151
206
  preferredRoute: GenerationExecutionRouteSchema,
152
207
  providerCredentials: z.array(ProviderCredentialStatusSchema),
208
+ codingInference: CodingInferenceSettingsSchema,
153
209
  }),
154
210
  );
@@ -62,6 +62,9 @@ export const GenerationJobSchema = z.object({
62
62
  cancel: GenerationOperationReferenceSchema.optional(),
63
63
  accept: GenerationOperationReferenceSchema.optional(),
64
64
  acceptedAt: z.string().datetime().optional(),
65
+ /** Last time a human/agent opened the native result. A later provider
66
+ * update makes the terminal result unread again without changing status. */
67
+ readAt: z.string().datetime().optional(),
65
68
  provenanceOperationId: z.string().optional(),
66
69
  outputPaths: z.array(z.string()).optional(),
67
70
  });
@@ -103,6 +106,9 @@ export interface GenerationJobUpdate {
103
106
  message?: string;
104
107
  billing?: GenerationBilling;
105
108
  cancel?: { tool: string; input: unknown };
109
+ /** `null` withdraws an acceptance action after polling proves that a
110
+ * successful operation produced no downloadable project output. */
111
+ accept?: { tool: string; input: unknown } | null;
106
112
  accepted?: {
107
113
  provenanceOperationId: string;
108
114
  outputPaths: string[];