@xfey/tutti 0.1.120 → 0.1.121

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.
Files changed (41) hide show
  1. package/dist/server-shell/http/routes/project-api/openapi-workspace-routes.d.ts +0 -2
  2. package/dist/server-shell/http/routes/project-api/openapi.d.ts +0 -2
  3. package/dist/server-shell/http/routes/project-api/schemas.d.ts +0 -1
  4. package/dist/server-shell/http/routes/project-api/types.d.ts +0 -1
  5. package/dist/server-shell/local-console/managed-project-service.d.ts +0 -10
  6. package/dist/server-shell/local-console/managed-project-service.js +1 -6
  7. package/dist/server-shell/local-console/project-service.d.ts +0 -1
  8. package/dist/server-shell/local-console/project-service.js +1 -2
  9. package/dist/server-shell/managed-access/legacy-records.d.ts +2 -0
  10. package/dist/server-shell/managed-access/legacy-records.js +24 -0
  11. package/dist/server-shell/managed-access/model-control-client.d.ts +0 -1
  12. package/dist/server-shell/managed-access/model-control-client.js +1 -3
  13. package/dist/server-shell/managed-access/project-provider.js +1 -1
  14. package/dist/server-shell/managed-access/records.d.ts +4 -9
  15. package/dist/server-shell/managed-access/records.js +4 -3
  16. package/dist/server-shell/managed-access/runtime-records.d.ts +4 -8
  17. package/dist/server-shell/managed-access/runtime-records.js +4 -4
  18. package/dist/server-shell/managed-access/runtime.js +5 -6
  19. package/dist/server-shell/managed-access/state.d.ts +1 -2
  20. package/dist/server-shell/managed-access/state.js +15 -10
  21. package/dist/server-shell/managed-access/transport.d.ts +0 -3
  22. package/dist/server-shell/managed-access/transport.js +2 -1
  23. package/node_modules/@tutti/relay-client/dist/project-authority.d.ts +0 -5
  24. package/node_modules/@tutti/relay-client/dist/project-authority.js +1 -2
  25. package/node_modules/@tutti/shared/dist/schemas/api/managed-account.d.ts +0 -1
  26. package/node_modules/@tutti/shared/dist/schemas/api/managed-account.js +0 -1
  27. package/node_modules/@tutti/shared/dist/schemas/api/provider-config.d.ts +0 -1
  28. package/node_modules/@tutti/shared/dist/schemas/api/provider-config.js +0 -1
  29. package/node_modules/@tutti/shared/dist/schemas/api/runtime-events.d.ts +0 -1
  30. package/node_modules/@tutti/shared/dist/schemas/internal/creation-validation.d.ts +1 -3
  31. package/node_modules/@tutti/shared/dist/schemas/internal/creation-validation.js +2 -4
  32. package/node_modules/@tutti/shared/dist/schemas/internal/managed-runtime.d.ts +1 -4
  33. package/node_modules/@tutti/shared/dist/schemas/internal/managed-runtime.js +3 -6
  34. package/node_modules/@tutti/shared/dist/schemas/internal/project-authority.d.ts +0 -6
  35. package/node_modules/@tutti/shared/dist/schemas/internal/project-authority.js +0 -8
  36. package/package.json +1 -1
  37. package/web/assets/{homepage-motion-scene-DyMFsYmT.js → homepage-motion-scene-WfLyzcCG.js} +1 -1
  38. package/web/assets/{index-DsYi7AhN.css → index-ATsYiBZs.css} +1 -1
  39. package/web/assets/index-o9YCtzEd.js +70 -0
  40. package/web/index.html +2 -2
  41. package/web/assets/index-DSlecDXC.js +0 -70
@@ -11,7 +11,6 @@ export declare const HOST_PROJECT_WORKSPACE_OPENAPI_ROUTES: ({
11
11
  }>, import("@sinclair/typebox").TObject<{
12
12
  status: import("@sinclair/typebox").TLiteral<"managed">;
13
13
  funding_kind: import("@sinclair/typebox").TLiteral<"trial">;
14
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
15
14
  }>, import("@sinclair/typebox").TObject<{
16
15
  status: import("@sinclair/typebox").TLiteral<"configured">;
17
16
  provider: import("@sinclair/typebox").TLiteral<"openai">;
@@ -869,7 +868,6 @@ export declare const HOST_PROJECT_WORKSPACE_OPENAPI_ROUTES: ({
869
868
  }>, import("@sinclair/typebox").TObject<{
870
869
  status: import("@sinclair/typebox").TLiteral<"managed">;
871
870
  funding_kind: import("@sinclair/typebox").TLiteral<"trial">;
872
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
873
871
  }>, import("@sinclair/typebox").TObject<{
874
872
  status: import("@sinclair/typebox").TLiteral<"configured">;
875
873
  provider: import("@sinclair/typebox").TLiteral<"openai">;
@@ -1318,7 +1318,6 @@ export declare const HOST_PROJECT_OPENAPI_ROUTES: ({
1318
1318
  }>, import("@sinclair/typebox").TObject<{
1319
1319
  status: import("@sinclair/typebox").TLiteral<"managed">;
1320
1320
  funding_kind: import("@sinclair/typebox").TLiteral<"trial">;
1321
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
1322
1321
  }>, import("@sinclair/typebox").TObject<{
1323
1322
  status: import("@sinclair/typebox").TLiteral<"configured">;
1324
1323
  provider: import("@sinclair/typebox").TLiteral<"openai">;
@@ -2176,7 +2175,6 @@ export declare const HOST_PROJECT_OPENAPI_ROUTES: ({
2176
2175
  }>, import("@sinclair/typebox").TObject<{
2177
2176
  status: import("@sinclair/typebox").TLiteral<"managed">;
2178
2177
  funding_kind: import("@sinclair/typebox").TLiteral<"trial">;
2179
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
2180
2178
  }>, import("@sinclair/typebox").TObject<{
2181
2179
  status: import("@sinclair/typebox").TLiteral<"configured">;
2182
2180
  provider: import("@sinclair/typebox").TLiteral<"openai">;
@@ -812,7 +812,6 @@ export declare const BootstrapResponseSchema: {
812
812
  }>, import("@sinclair/typebox").TObject<{
813
813
  status: import("@sinclair/typebox").TLiteral<"managed">;
814
814
  funding_kind: import("@sinclair/typebox").TLiteral<"trial">;
815
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
816
815
  }>, import("@sinclair/typebox").TObject<{
817
816
  status: import("@sinclair/typebox").TLiteral<"configured">;
818
817
  provider: import("@sinclair/typebox").TLiteral<"openai">;
@@ -25,7 +25,6 @@ export type ResolvedStagedUpload = {
25
25
  export type HostProviderConfigProjection = {
26
26
  status: "managed";
27
27
  funding_kind: "trial";
28
- tier: "light" | "high" | "max";
29
28
  } | {
30
29
  status: "not_configured";
31
30
  } | {
@@ -8,7 +8,6 @@ export declare const ManagedDraftInputSchema: import("@sinclair/typebox").TObjec
8
8
  display_name: import("@sinclair/typebox").TString;
9
9
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
10
  surface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"standalone">, import("@sinclair/typebox").TLiteral<"feishu">]>;
11
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
12
11
  existing_project_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
12
  }>;
14
13
  export type ManagedDraftInput = Static<typeof ManagedDraftInputSchema>;
@@ -30,7 +29,6 @@ export declare class LocalConsoleManagedProjectService {
30
29
  expires_at: string;
31
30
  existing_project_id?: `prj_${string}`;
32
31
  surface: "standalone" | "feishu";
33
- tier: "light" | "high" | "max";
34
32
  description?: string;
35
33
  request_ref: string;
36
34
  project_id: `prj_${string}`;
@@ -43,7 +41,6 @@ export declare class LocalConsoleManagedProjectService {
43
41
  expires_before?: string;
44
42
  installation_ref: string;
45
43
  surface: "standalone" | "feishu";
46
- tier: "light" | "high" | "max";
47
44
  request_ref: string;
48
45
  project_id: string;
49
46
  installation_secret_hash: string;
@@ -58,7 +55,6 @@ export declare class LocalConsoleManagedProjectService {
58
55
  expires_at: string;
59
56
  existing_project_id?: `prj_${string}`;
60
57
  surface: "standalone" | "feishu";
61
- tier: "light" | "high" | "max";
62
58
  description?: string;
63
59
  request_ref: string;
64
60
  project_id: `prj_${string}`;
@@ -71,7 +67,6 @@ export declare class LocalConsoleManagedProjectService {
71
67
  expires_before?: string;
72
68
  installation_ref: string;
73
69
  surface: "standalone" | "feishu";
74
- tier: "light" | "high" | "max";
75
70
  request_ref: string;
76
71
  project_id: string;
77
72
  installation_secret_hash: string;
@@ -86,7 +81,6 @@ export declare class LocalConsoleManagedProjectService {
86
81
  expires_at: string;
87
82
  existing_project_id?: `prj_${string}`;
88
83
  surface: "standalone" | "feishu";
89
- tier: "light" | "high" | "max";
90
84
  description?: string;
91
85
  request_ref: string;
92
86
  project_id: `prj_${string}`;
@@ -99,7 +93,6 @@ export declare class LocalConsoleManagedProjectService {
99
93
  expires_before?: string;
100
94
  installation_ref: string;
101
95
  surface: "standalone" | "feishu";
102
- tier: "light" | "high" | "max";
103
96
  request_ref: string;
104
97
  project_id: string;
105
98
  installation_secret_hash: string;
@@ -112,7 +105,6 @@ export declare class LocalConsoleManagedProjectService {
112
105
  validation: {
113
106
  state: "failed" | "unknown" | "started" | "succeeded";
114
107
  installation_ref: string;
115
- tier: "light" | "high" | "max";
116
108
  reason_code: "validation_started" | "validation_succeeded" | "validation_route_unavailable" | "validation_http_rejected" | "validation_response_invalid" | "validation_transport_unknown" | "validation_interrupted";
117
109
  project_id: string;
118
110
  creation_ref: string;
@@ -124,7 +116,6 @@ export declare class LocalConsoleManagedProjectService {
124
116
  expires_at: string;
125
117
  existing_project_id?: `prj_${string}`;
126
118
  surface: "standalone" | "feishu";
127
- tier: "light" | "high" | "max";
128
119
  description?: string;
129
120
  request_ref: string;
130
121
  project_id: `prj_${string}`;
@@ -137,7 +128,6 @@ export declare class LocalConsoleManagedProjectService {
137
128
  expires_before?: string;
138
129
  installation_ref: string;
139
130
  surface: "standalone" | "feishu";
140
- tier: "light" | "high" | "max";
141
131
  request_ref: string;
142
132
  project_id: string;
143
133
  installation_secret_hash: string;
@@ -1,7 +1,6 @@
1
1
  import { Value } from "@sinclair/typebox/value";
2
2
  import { Type } from "@sinclair/typebox";
3
3
  import { IdempotencyKeySchema, ProjectIdSchema } from "@tutti/shared/schemas/domain";
4
- import { ManagedTierSchema } from "@tutti/shared/schemas/internal";
5
4
  import { resolveLaunchLocalContext } from "../cli/launch.js";
6
5
  import { NativeManagedState } from "../managed-access/state.js";
7
6
  import { findNativeManagedProject } from "../managed-access/state.js";
@@ -15,7 +14,6 @@ export const ManagedDraftInputSchema = Type.Object({
15
14
  display_name: Type.String({ minLength: 1, maxLength: 80 }),
16
15
  description: Type.Optional(Type.String({ maxLength: 160 })),
17
16
  surface: Type.Union([Type.Literal("standalone"), Type.Literal("feishu")]),
18
- tier: ManagedTierSchema,
19
17
  existing_project_id: Type.Optional(ProjectIdSchema),
20
18
  }, { additionalProperties: false });
21
19
  function projection(row) {
@@ -26,7 +24,6 @@ function projection(row) {
26
24
  workspace_path: row.workspace_root,
27
25
  ...(row.description === undefined ? {} : { description: row.description }),
28
26
  surface: row.surface,
29
- tier: row.tier,
30
27
  ...(row.existing_relay_project_ref === undefined
31
28
  ? {}
32
29
  : { existing_project_id: row.project_id }),
@@ -80,8 +77,7 @@ export class LocalConsoleManagedProjectService {
80
77
  relayUrl: state.origin,
81
78
  projectId: input.existing_project_id,
82
79
  });
83
- if (previous !== null &&
84
- (previous.journal.state !== "registered" || previous.journal.tier !== input.tier))
80
+ if (previous !== null && previous.journal.state !== "registered")
85
81
  throw new ManagedLocalStateError("managed_reauthorization_conflict");
86
82
  existing = {
87
83
  ...target,
@@ -94,7 +90,6 @@ export class LocalConsoleManagedProjectService {
94
90
  displayName: input.display_name.trim(),
95
91
  ...(input.description === undefined ? {} : { description: input.description.trim() }),
96
92
  surface: input.surface,
97
- tier: input.tier,
98
93
  ...(existing === undefined ? {} : { projectId: input.existing_project_id, existing }),
99
94
  now: this.options.now?.() ?? new Date(),
100
95
  });
@@ -17,7 +17,6 @@ export type LocalConsoleProject = {
17
17
  status: RuntimeProjectRow["status"];
18
18
  provider_status: ProviderConfigProjection["status"];
19
19
  provider_model?: string;
20
- provider_tier?: "light" | "high" | "max";
21
20
  relay_project_ref?: RelayProjectRef;
22
21
  open_url?: string;
23
22
  relay_connection_status?: string;
@@ -217,7 +217,7 @@ export class LocalConsoleProjectService {
217
217
  const providerModel = provider.status === "not_configured"
218
218
  ? undefined
219
219
  : provider.status === "managed"
220
- ? `Tutti ${provider.tier}`
220
+ ? "Tutti"
221
221
  : provider.default_model;
222
222
  const activityAt = readProjectActivityAt(this.#tuttiHome, row, binding);
223
223
  return {
@@ -229,7 +229,6 @@ export class LocalConsoleProjectService {
229
229
  resolveRelayUrl(operation.env),
230
230
  surfaceProfile: binding?.surface_profile ?? createProjectSurfaceProfile(),
231
231
  }),
232
- ...(provider.status === "managed" ? { provider_tier: provider.tier } : {}),
233
232
  };
234
233
  });
235
234
  }
@@ -0,0 +1,2 @@
1
+ export declare function upgradeTieredPrivateRecord(value: unknown, withAuthority?: boolean): unknown;
2
+ //# sourceMappingURL=legacy-records.d.ts.map
@@ -0,0 +1,24 @@
1
+ // The only compatibility boundary for 0.1.120 private records. This is not a
2
+ // network parser: callers still validate the complete current strict schema.
3
+ export function upgradeTieredPrivateRecord(value, withAuthority = false) {
4
+ if (!value || typeof value !== "object" || !("version" in value) || value.version !== 1)
5
+ return value;
6
+ if (!("tier" in value) ||
7
+ typeof value.tier !== "string" ||
8
+ !["light", "high", "max"].includes(value.tier))
9
+ return value;
10
+ const { tier, ...fields } = value;
11
+ if (withAuthority && "authority" in fields) {
12
+ const authority = fields.authority;
13
+ if (!authority ||
14
+ typeof authority !== "object" ||
15
+ !("tier" in authority) ||
16
+ authority.tier !== tier)
17
+ return value;
18
+ const projection = { ...authority };
19
+ delete projection.tier;
20
+ return { ...fields, version: 2, authority: projection };
21
+ }
22
+ return { ...fields, version: 2 };
23
+ }
24
+ //# sourceMappingURL=legacy-records.js.map
@@ -16,7 +16,6 @@ export declare class NativeModelControlClient {
16
16
  private request;
17
17
  pin(sessionRef: string, routeRef?: string): Promise<{
18
18
  disposition: "created" | "existing";
19
- tier: "light" | "high" | "max";
20
19
  session_ref: string;
21
20
  provider: {
22
21
  model: string;
@@ -14,11 +14,9 @@ export class ManagedControlError extends ManagedLocalStateError {
14
14
  const reasons = new Set([
15
15
  "authority_invalid",
16
16
  "host_delegation_revoked",
17
- "delegated_tier_fixed",
18
17
  "delegated_installation_fixed",
19
18
  "session_not_found",
20
- "session_tier_fixed",
21
- "tier_unavailable",
19
+ "default_route_unavailable",
22
20
  "pinned_route_unavailable",
23
21
  "gateway_route_drift",
24
22
  "credential_request_mismatch",
@@ -9,7 +9,7 @@ import { NativeManagedRuntime } from "./runtime.js";
9
9
  export function readProjectModelAccess(options) {
10
10
  const native = findNativeManagedProject(options);
11
11
  if (native !== null) {
12
- return { status: "managed", funding_kind: "trial", tier: native.journal.tier };
12
+ return { status: "managed", funding_kind: "trial" };
13
13
  }
14
14
  return readOpenAiProviderConfigProjection(options);
15
15
  }
@@ -10,7 +10,7 @@ export declare const InstallationSchema: import("@sinclair/typebox").TObject<{
10
10
  export type Installation = Static<typeof InstallationSchema>;
11
11
  export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
12
12
  state: import("@sinclair/typebox").TLiteral<"awaiting_authorization">;
13
- version: import("@sinclair/typebox").TLiteral<1>;
13
+ version: import("@sinclair/typebox").TLiteral<2>;
14
14
  request_ref: import("@sinclair/typebox").TString;
15
15
  project_id: import("@sinclair/typebox").TString;
16
16
  relay_origin: import("@sinclair/typebox").TString;
@@ -19,7 +19,6 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
19
19
  display_name: import("@sinclair/typebox").TString;
20
20
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
21
  surface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"standalone">, import("@sinclair/typebox").TLiteral<"feishu">]>;
22
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
23
22
  existing_relay_project_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
23
  previous_request_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
24
  handoff_token: import("@sinclair/typebox").TString;
@@ -29,7 +28,7 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
29
28
  }>, import("@sinclair/typebox").TObject<{
30
29
  state: import("@sinclair/typebox").TLiteral<"prepared">;
31
30
  creation_ref: import("@sinclair/typebox").TString;
32
- version: import("@sinclair/typebox").TLiteral<1>;
31
+ version: import("@sinclair/typebox").TLiteral<2>;
33
32
  request_ref: import("@sinclair/typebox").TString;
34
33
  project_id: import("@sinclair/typebox").TString;
35
34
  relay_origin: import("@sinclair/typebox").TString;
@@ -38,7 +37,6 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
38
37
  display_name: import("@sinclair/typebox").TString;
39
38
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
40
39
  surface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"standalone">, import("@sinclair/typebox").TLiteral<"feishu">]>;
41
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
42
40
  existing_relay_project_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
43
41
  previous_request_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
44
42
  handoff_token: import("@sinclair/typebox").TString;
@@ -48,7 +46,7 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
48
46
  }>, import("@sinclair/typebox").TObject<{
49
47
  state: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"validated">, import("@sinclair/typebox").TLiteral<"validation_unknown">, import("@sinclair/typebox").TLiteral<"validation_failed">]>;
50
48
  creation_ref: import("@sinclair/typebox").TString;
51
- version: import("@sinclair/typebox").TLiteral<1>;
49
+ version: import("@sinclair/typebox").TLiteral<2>;
52
50
  request_ref: import("@sinclair/typebox").TString;
53
51
  project_id: import("@sinclair/typebox").TString;
54
52
  relay_origin: import("@sinclair/typebox").TString;
@@ -57,7 +55,6 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
57
55
  display_name: import("@sinclair/typebox").TString;
58
56
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
59
57
  surface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"standalone">, import("@sinclair/typebox").TLiteral<"feishu">]>;
60
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
61
58
  existing_relay_project_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
62
59
  previous_request_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
63
60
  handoff_token: import("@sinclair/typebox").TString;
@@ -72,13 +69,12 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
72
69
  grant_ref: import("@sinclair/typebox").TString;
73
70
  relay_project_ref: import("@sinclair/typebox").TString;
74
71
  installation_ref: import("@sinclair/typebox").TString;
75
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
76
72
  funding_kind: import("@sinclair/typebox").TLiteral<"trial">;
77
73
  expires_at: import("@sinclair/typebox").TNull;
78
74
  state: import("@sinclair/typebox").TLiteral<"active">;
79
75
  model_access: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"runtime_authority_required">, import("@sinclair/typebox").TLiteral<"not_enabled">]>;
80
76
  }>;
81
- version: import("@sinclair/typebox").TLiteral<1>;
77
+ version: import("@sinclair/typebox").TLiteral<2>;
82
78
  request_ref: import("@sinclair/typebox").TString;
83
79
  project_id: import("@sinclair/typebox").TString;
84
80
  relay_origin: import("@sinclair/typebox").TString;
@@ -87,7 +83,6 @@ export declare const CreationJournalSchema: import("@sinclair/typebox").TUnion<[
87
83
  display_name: import("@sinclair/typebox").TString;
88
84
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
89
85
  surface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"standalone">, import("@sinclair/typebox").TLiteral<"feishu">]>;
90
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
91
86
  existing_relay_project_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
92
87
  previous_request_ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
93
88
  handoff_token: import("@sinclair/typebox").TString;
@@ -1,8 +1,9 @@
1
1
  import { Type } from "@sinclair/typebox";
2
2
  import { Value } from "@sinclair/typebox/value";
3
3
  import { IdempotencyKeySchema, ProjectIdSchema, RelayProjectRefSchema, } from "@tutti/shared/schemas/domain";
4
- import { AuthoritySecretSchema, AuthorityTimestampSchema, isAuthorityTimestamp, HostInstallationRefSchema, HostDelegationProjectionSchema, ManagedCreationRefSchema, ManagedTierSchema, } from "@tutti/shared/schemas/internal";
4
+ import { AuthoritySecretSchema, AuthorityTimestampSchema, isAuthorityTimestamp, HostInstallationRefSchema, HostDelegationProjectionSchema, ManagedCreationRefSchema, } from "@tutti/shared/schemas/internal";
5
5
  import { ManagedLocalStateError } from "./private-store.js";
6
+ import { upgradeTieredPrivateRecord } from "./legacy-records.js";
6
7
  export const InstallationSchema = Type.Object({
7
8
  version: Type.Literal(1),
8
9
  relay_origin: Type.String({ maxLength: 500 }),
@@ -11,7 +12,7 @@ export const InstallationSchema = Type.Object({
11
12
  created_at: AuthorityTimestampSchema,
12
13
  }, { additionalProperties: false });
13
14
  const DraftFields = {
14
- version: Type.Literal(1),
15
+ version: Type.Literal(2),
15
16
  request_ref: IdempotencyKeySchema,
16
17
  project_id: ProjectIdSchema,
17
18
  relay_origin: Type.String({ maxLength: 500 }),
@@ -20,7 +21,6 @@ const DraftFields = {
20
21
  display_name: Type.String({ minLength: 1, maxLength: 80 }),
21
22
  description: Type.Optional(Type.String({ maxLength: 160 })),
22
23
  surface: Type.Union([Type.Literal("standalone"), Type.Literal("feishu")]),
23
- tier: ManagedTierSchema,
24
24
  existing_relay_project_ref: Type.Optional(RelayProjectRefSchema),
25
25
  previous_request_ref: Type.Optional(IdempotencyKeySchema),
26
26
  handoff_token: AuthoritySecretSchema,
@@ -60,6 +60,7 @@ export function parseInstallation(raw, origin) {
60
60
  return raw;
61
61
  }
62
62
  export function parseJournal(raw, origin, requestRef) {
63
+ raw = upgradeTieredPrivateRecord(raw, true);
63
64
  if (!Value.Check(CreationJournalSchema, raw) ||
64
65
  raw.relay_origin !== origin ||
65
66
  raw.request_ref !== requestRef ||
@@ -6,12 +6,11 @@ export declare const ModelSessionOwnerSchema: import("@sinclair/typebox").TObjec
6
6
  export type ModelSessionOwner = Static<typeof ModelSessionOwnerSchema>;
7
7
  declare const SessionSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
8
8
  state: import("@sinclair/typebox").TLiteral<"ready">;
9
- version: import("@sinclair/typebox").TLiteral<1>;
9
+ version: import("@sinclair/typebox").TLiteral<2>;
10
10
  project_id: import("@sinclair/typebox").TString;
11
11
  delegation_ref: import("@sinclair/typebox").TString;
12
12
  grant_ref: import("@sinclair/typebox").TString;
13
13
  installation_ref: import("@sinclair/typebox").TString;
14
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
15
14
  owner: import("@sinclair/typebox").TObject<{
16
15
  kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"chat">, import("@sinclair/typebox").TLiteral<"workflow">, import("@sinclair/typebox").TLiteral<"task">]>;
17
16
  ref: import("@sinclair/typebox").TString;
@@ -25,12 +24,11 @@ declare const SessionSchema: import("@sinclair/typebox").TUnion<[import("@sincla
25
24
  }>, import("@sinclair/typebox").TObject<{
26
25
  state: import("@sinclair/typebox").TLiteral<"issuing">;
27
26
  request_ref: import("@sinclair/typebox").TString;
28
- version: import("@sinclair/typebox").TLiteral<1>;
27
+ version: import("@sinclair/typebox").TLiteral<2>;
29
28
  project_id: import("@sinclair/typebox").TString;
30
29
  delegation_ref: import("@sinclair/typebox").TString;
31
30
  grant_ref: import("@sinclair/typebox").TString;
32
31
  installation_ref: import("@sinclair/typebox").TString;
33
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
34
32
  owner: import("@sinclair/typebox").TObject<{
35
33
  kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"chat">, import("@sinclair/typebox").TLiteral<"workflow">, import("@sinclair/typebox").TLiteral<"task">]>;
36
34
  ref: import("@sinclair/typebox").TString;
@@ -57,12 +55,11 @@ declare const SessionSchema: import("@sinclair/typebox").TUnion<[import("@sincla
57
55
  model: import("@sinclair/typebox").TString;
58
56
  api_key: import("@sinclair/typebox").TString;
59
57
  }>;
60
- version: import("@sinclair/typebox").TLiteral<1>;
58
+ version: import("@sinclair/typebox").TLiteral<2>;
61
59
  project_id: import("@sinclair/typebox").TString;
62
60
  delegation_ref: import("@sinclair/typebox").TString;
63
61
  grant_ref: import("@sinclair/typebox").TString;
64
62
  installation_ref: import("@sinclair/typebox").TString;
65
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
66
63
  owner: import("@sinclair/typebox").TObject<{
67
64
  kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"chat">, import("@sinclair/typebox").TLiteral<"workflow">, import("@sinclair/typebox").TLiteral<"task">]>;
68
65
  ref: import("@sinclair/typebox").TString;
@@ -84,12 +81,11 @@ declare const SessionSchema: import("@sinclair/typebox").TUnion<[import("@sincla
84
81
  expires_at: import("@sinclair/typebox").TInteger;
85
82
  quota_cap: import("@sinclair/typebox").TInteger;
86
83
  }>;
87
- version: import("@sinclair/typebox").TLiteral<1>;
84
+ version: import("@sinclair/typebox").TLiteral<2>;
88
85
  project_id: import("@sinclair/typebox").TString;
89
86
  delegation_ref: import("@sinclair/typebox").TString;
90
87
  grant_ref: import("@sinclair/typebox").TString;
91
88
  installation_ref: import("@sinclair/typebox").TString;
92
- tier: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"max">]>;
93
89
  owner: import("@sinclair/typebox").TObject<{
94
90
  kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"chat">, import("@sinclair/typebox").TLiteral<"workflow">, import("@sinclair/typebox").TLiteral<"task">]>;
95
91
  ref: import("@sinclair/typebox").TString;
@@ -1,19 +1,19 @@
1
1
  import { Type } from "@sinclair/typebox";
2
2
  import { Value } from "@sinclair/typebox/value";
3
3
  import { ProjectIdSchema, IdempotencyKeySchema } from "@tutti/shared/schemas/domain";
4
- import { HostDelegationRefSchema, HostInstallationRefSchema, ProjectModelGrantRefSchema, ManagedTierSchema, ManagedRuntimeSessionRefSchema, ManagedRouteRefSchema, ManagedCredentialProjectionSchema, ManagedProviderCredentialSchema, } from "@tutti/shared/schemas/internal";
4
+ import { HostDelegationRefSchema, HostInstallationRefSchema, ProjectModelGrantRefSchema, ManagedRuntimeSessionRefSchema, ManagedRouteRefSchema, ManagedCredentialProjectionSchema, ManagedProviderCredentialSchema, } from "@tutti/shared/schemas/internal";
5
5
  import { ManagedLocalStateError } from "./private-store.js";
6
+ import { upgradeTieredPrivateRecord } from "./legacy-records.js";
6
7
  export const ModelSessionOwnerSchema = Type.Object({
7
8
  kind: Type.Union([Type.Literal("chat"), Type.Literal("workflow"), Type.Literal("task")]),
8
9
  ref: Type.String({ pattern: "^[A-Za-z0-9_-]{1,150}$" }),
9
10
  }, { additionalProperties: false });
10
11
  const Common = {
11
- version: Type.Literal(1),
12
+ version: Type.Literal(2),
12
13
  project_id: ProjectIdSchema,
13
14
  delegation_ref: HostDelegationRefSchema,
14
15
  grant_ref: ProjectModelGrantRefSchema,
15
16
  installation_ref: HostInstallationRefSchema,
16
- tier: ManagedTierSchema,
17
17
  owner: ModelSessionOwnerSchema,
18
18
  session_ref: ManagedRuntimeSessionRefSchema,
19
19
  route_ref: Type.Optional(ManagedRouteRefSchema),
@@ -40,6 +40,7 @@ const SessionSchema = Type.Union([
40
40
  }, { additionalProperties: false }),
41
41
  ]);
42
42
  export function parseNativeModelSession(value) {
43
+ value = upgradeTieredPrivateRecord(value);
43
44
  if (!Value.Check(SessionSchema, value))
44
45
  throw new ManagedLocalStateError("managed_model_session_invalid");
45
46
  if ((value.state === "active" || value.state === "revoking") &&
@@ -54,7 +55,6 @@ export function readyModelSession(row) {
54
55
  delegation_ref: row.delegation_ref,
55
56
  grant_ref: row.grant_ref,
56
57
  installation_ref: row.installation_ref,
57
- tier: row.tier,
58
58
  owner: row.owner,
59
59
  session_ref: row.session_ref,
60
60
  state: "ready",
@@ -34,7 +34,7 @@ export class NativeManagedRuntime {
34
34
  },
35
35
  ...(options.fetchImpl === undefined ? {} : { fetchImpl: options.fetchImpl }),
36
36
  });
37
- if (authority.tier !== journal.tier ||
37
+ if (authority.delegation_ref !== journal.authority.delegation_ref ||
38
38
  authority.expires_at <= Math.floor(this.now().getTime() / 1000))
39
39
  throw new ManagedLocalStateError("managed_runtime_authority_mismatch");
40
40
  return authority;
@@ -65,8 +65,7 @@ export class NativeManagedRuntime {
65
65
  if (row.project_id !== this.options.projectId ||
66
66
  row.owner.kind !== owner.kind ||
67
67
  row.owner.ref !== owner.ref ||
68
- row.installation_ref !== authority.installation_ref ||
69
- row.tier !== authority.tier)
68
+ row.installation_ref !== authority.installation_ref)
70
69
  throw new ManagedLocalStateError("managed_model_session_scope_changed");
71
70
  if (row.delegation_ref !== authority.delegation_ref ||
72
71
  row.grant_ref !== authority.grant_ref) {
@@ -85,15 +84,16 @@ export class NativeManagedRuntime {
85
84
  this.files.write(`${name}.json`, renewed);
86
85
  return renewed;
87
86
  }
87
+ if (typeof saved === "object" && "version" in saved && saved.version === 1)
88
+ this.files.write(`${name}.json`, row);
88
89
  return row;
89
90
  }
90
91
  const row = {
91
- version: 1,
92
+ version: 2,
92
93
  project_id: this.options.projectId,
93
94
  delegation_ref: authority.delegation_ref,
94
95
  grant_ref: authority.grant_ref,
95
96
  installation_ref: authority.installation_ref,
96
- tier: authority.tier,
97
97
  owner,
98
98
  session_ref: createPrefixedId(ID_PREFIXES.managedSession),
99
99
  state: "ready",
@@ -111,7 +111,6 @@ export class NativeManagedRuntime {
111
111
  async pin(name, row) {
112
112
  const pin = await this.client.pin(row.session_ref, row.route_ref);
113
113
  if (pin.session_ref !== row.session_ref ||
114
- pin.tier !== row.tier ||
115
114
  (row.route_ref !== undefined && pin.route_ref !== row.route_ref) ||
116
115
  (row.provider_identity !== undefined &&
117
116
  (row.provider_identity.model !== pin.provider.model ||
@@ -22,7 +22,6 @@ export declare class NativeManagedState {
22
22
  displayName: string;
23
23
  description?: string;
24
24
  surface: "standalone" | "feishu";
25
- tier: "light" | "high" | "max";
26
25
  requestRef?: string;
27
26
  projectId?: string;
28
27
  existing?: {
@@ -33,6 +32,7 @@ export declare class NativeManagedState {
33
32
  now?: Date;
34
33
  }): CreationJournal;
35
34
  read(requestRef: string): CreationJournal;
35
+ private readJournal;
36
36
  attachProject(requestRef: string, now?: Date): CreationJournal;
37
37
  project(projectId: string): CreationJournal;
38
38
  preparationBody(requestRef: string): PrepareProjectAuthority;
@@ -42,7 +42,6 @@ export declare class NativeManagedState {
42
42
  project_id: string;
43
43
  installation_ref: string;
44
44
  surface: string;
45
- tier: string;
46
45
  expires_at: string;
47
46
  }, now?: Date): CreationJournal;
48
47
  validation(requestRef: string, outcome: "validated" | "validation_unknown" | "validation_failed"): CreationJournal;
@@ -85,12 +85,11 @@ export class NativeManagedState {
85
85
  return this.files.transaction(() => {
86
86
  const saved = this.files.read(name);
87
87
  if (saved !== null) {
88
- const record = parseJournal(saved, this.origin, requestRef);
88
+ const record = this.readJournal(requestRef);
89
89
  if (record.workspace_root !== workspace ||
90
90
  record.display_name !== options.displayName ||
91
91
  record.description !== options.description ||
92
92
  record.surface !== options.surface ||
93
- record.tier !== options.tier ||
94
93
  (options.projectId !== undefined && record.project_id !== options.projectId) ||
95
94
  record.existing_relay_project_ref !== options.existing?.relayProjectRef ||
96
95
  record.previous_request_ref !== options.existing?.previousRequestRef ||
@@ -101,7 +100,7 @@ export class NativeManagedState {
101
100
  return record;
102
101
  }
103
102
  const record = parseJournal({
104
- version: 1,
103
+ version: 2,
105
104
  request_ref: requestRef,
106
105
  project_id: options.projectId ?? createProjectId(),
107
106
  relay_origin: this.origin,
@@ -110,7 +109,6 @@ export class NativeManagedState {
110
109
  display_name: options.displayName,
111
110
  ...(options.description === undefined ? {} : { description: options.description }),
112
111
  surface: options.surface,
113
- tier: options.tier,
114
112
  ...(options.existing === undefined
115
113
  ? {}
116
114
  : {
@@ -130,12 +128,22 @@ export class NativeManagedState {
130
128
  });
131
129
  }
132
130
  read(requestRef) {
133
- return this.files.transaction(() => parseJournal(this.files.read(this.journalName(requestRef)), this.origin, requestRef));
131
+ return this.files.transaction(() => this.readJournal(requestRef));
132
+ }
133
+ // Called only inside the private-store mutex. Upgrade metadata atomically;
134
+ // never rotate proofs, extend consent or restore revoked runtime credentials.
135
+ readJournal(requestRef) {
136
+ const name = this.journalName(requestRef);
137
+ const saved = this.files.read(name);
138
+ const row = parseJournal(saved, this.origin, requestRef);
139
+ if (saved && typeof saved === "object" && "version" in saved && saved.version === 1)
140
+ this.files.write(name, row);
141
+ return row;
134
142
  }
135
143
  attachProject(requestRef, now = new Date()) {
136
144
  this.bootstrap(requestRef, now);
137
145
  return this.files.transaction(() => {
138
- const row = parseJournal(this.files.read(this.journalName(requestRef)), this.origin, requestRef);
146
+ const row = this.readJournal(requestRef);
139
147
  const name = `project-${row.project_id}.json`;
140
148
  const old = this.files.read(name);
141
149
  if (old !== null &&
@@ -156,7 +164,7 @@ export class NativeManagedState {
156
164
  const pointer = this.files.read(`project-${projectId}.json`);
157
165
  if (!Value.Check(NativeProjectPointerSchema, pointer) || pointer.project_id !== projectId)
158
166
  throw new ManagedLocalStateError("managed_project_binding_invalid");
159
- const row = parseJournal(this.files.read(this.journalName(pointer.request_ref)), this.origin, pointer.request_ref);
167
+ const row = this.readJournal(pointer.request_ref);
160
168
  if (row.project_id !== projectId || (row.state !== "validated" && row.state !== "registered"))
161
169
  throw new ManagedLocalStateError("managed_project_binding_invalid");
162
170
  return row;
@@ -170,7 +178,6 @@ export class NativeManagedState {
170
178
  request_ref: row.request_ref,
171
179
  project_id: row.project_id,
172
180
  surface: row.surface,
173
- tier: row.tier,
174
181
  ...(row.existing_relay_project_ref === undefined
175
182
  ? {}
176
183
  : { existing_relay_project_ref: row.existing_relay_project_ref }),
@@ -201,7 +208,6 @@ export class NativeManagedState {
201
208
  if (row.project_id !== receipt.project_id ||
202
209
  row.installation_ref !== receipt.installation_ref ||
203
210
  row.surface !== receipt.surface ||
204
- row.tier !== receipt.tier ||
205
211
  !Number.isFinite(Date.parse(receipt.expires_at)) ||
206
212
  Date.parse(receipt.expires_at) > Date.parse(row.expires_at))
207
213
  throw new ManagedLocalStateError("managed_preparation_mismatch");
@@ -253,7 +259,6 @@ export class NativeManagedState {
253
259
  return this.update(requestRef, (row) => {
254
260
  if (!Value.Check(HostDelegationProjectionSchema, authority) ||
255
261
  authority.installation_ref !== row.installation_ref ||
256
- authority.tier !== row.tier ||
257
262
  (row.existing_relay_project_ref !== undefined &&
258
263
  authority.relay_project_ref !== row.existing_relay_project_ref))
259
264
  throw new ManagedLocalStateError("managed_registration_mismatch");