@xfey/tutti 0.1.120 → 0.1.122
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/platform-outbound/repository.js +5 -0
- package/dist/platform-outbound/task-result-text.d.ts +3 -0
- package/dist/platform-outbound/task-result-text.js +26 -0
- package/dist/server-shell/http/routes/project-api/openapi-workspace-routes.d.ts +0 -2
- package/dist/server-shell/http/routes/project-api/openapi.d.ts +0 -2
- package/dist/server-shell/http/routes/project-api/schemas.d.ts +0 -1
- package/dist/server-shell/http/routes/project-api/types.d.ts +0 -1
- package/dist/server-shell/local-console/managed-project-routes.js +15 -1
- package/dist/server-shell/local-console/managed-project-service.d.ts +26 -10
- package/dist/server-shell/local-console/managed-project-service.js +22 -6
- package/dist/server-shell/local-console/project-service.d.ts +0 -1
- package/dist/server-shell/local-console/project-service.js +1 -2
- package/dist/server-shell/managed-access/legacy-records.d.ts +2 -0
- package/dist/server-shell/managed-access/legacy-records.js +24 -0
- package/dist/server-shell/managed-access/model-control-client.d.ts +0 -1
- package/dist/server-shell/managed-access/model-control-client.js +1 -3
- package/dist/server-shell/managed-access/project-provider.js +1 -1
- package/dist/server-shell/managed-access/records.d.ts +4 -9
- package/dist/server-shell/managed-access/records.js +4 -3
- package/dist/server-shell/managed-access/runtime-records.d.ts +4 -8
- package/dist/server-shell/managed-access/runtime-records.js +4 -4
- package/dist/server-shell/managed-access/runtime.js +5 -6
- package/dist/server-shell/managed-access/state.d.ts +1 -2
- package/dist/server-shell/managed-access/state.js +15 -10
- package/dist/server-shell/managed-access/transport.d.ts +0 -3
- package/dist/server-shell/managed-access/transport.js +2 -1
- package/node_modules/@tutti/relay-client/dist/project-authority.d.ts +12 -6
- package/node_modules/@tutti/relay-client/dist/project-authority.js +21 -3
- package/node_modules/@tutti/shared/dist/schemas/api/local-console-account-handoffs.d.ts +1 -0
- package/node_modules/@tutti/shared/dist/schemas/api/local-console-account-handoffs.js +1 -0
- package/node_modules/@tutti/shared/dist/schemas/api/managed-account.d.ts +0 -1
- package/node_modules/@tutti/shared/dist/schemas/api/managed-account.js +0 -1
- package/node_modules/@tutti/shared/dist/schemas/api/provider-config.d.ts +0 -1
- package/node_modules/@tutti/shared/dist/schemas/api/provider-config.js +0 -1
- package/node_modules/@tutti/shared/dist/schemas/api/runtime-events.d.ts +0 -1
- package/node_modules/@tutti/shared/dist/schemas/internal/creation-validation.d.ts +1 -3
- package/node_modules/@tutti/shared/dist/schemas/internal/creation-validation.js +2 -4
- package/node_modules/@tutti/shared/dist/schemas/internal/managed-runtime.d.ts +1 -4
- package/node_modules/@tutti/shared/dist/schemas/internal/managed-runtime.js +3 -6
- package/node_modules/@tutti/shared/dist/schemas/internal/project-authority.d.ts +16 -6
- package/node_modules/@tutti/shared/dist/schemas/internal/project-authority.js +4 -8
- package/package.json +1 -1
- package/web/assets/{homepage-motion-scene-DyMFsYmT.js → homepage-motion-scene-ClLzlKMk.js} +1 -1
- package/web/assets/{index-DsYi7AhN.css → index-DTaMPmTW.css} +1 -1
- package/web/assets/index-v5xKB6AX.js +70 -0
- package/web/index.html +2 -2
- package/web/assets/index-DSlecDXC.js +0 -70
|
@@ -2,6 +2,7 @@ import { createIdempotencyKey, } from "@tutti/shared/ids";
|
|
|
2
2
|
import { Value } from "@sinclair/typebox/value";
|
|
3
3
|
import { PlatformOutboundContentSchema, } from "@tutti/shared/schemas/internal";
|
|
4
4
|
import { readClarificationRoundProjection, readClarificationThreadResponse, } from "../collaboration-state/index.js";
|
|
5
|
+
import { platformTaskResultText } from "./task-result-text.js";
|
|
5
6
|
const MAX_PLATFORM_OUTBOUND_TEXT_LENGTH = 4_000;
|
|
6
7
|
function boundedPlatformOutboundText(value) {
|
|
7
8
|
const characters = [...value.trim()];
|
|
@@ -153,6 +154,7 @@ export function materializePlatformStatusOutboundIntents(db, now = () => new Dat
|
|
|
153
154
|
(status !== "completed" && status !== "failed")) {
|
|
154
155
|
continue;
|
|
155
156
|
}
|
|
157
|
+
const contentText = platformTaskResultText(taskResult);
|
|
156
158
|
const result = createPlatformStatusOutboundIntent(db, {
|
|
157
159
|
eventKind: status === "completed" ? "task_completed" : "task_failed",
|
|
158
160
|
eventKey: `task_result:${resultKey}`,
|
|
@@ -160,6 +162,9 @@ export function materializePlatformStatusOutboundIntents(db, now = () => new Dat
|
|
|
160
162
|
subjectRef: resultKey,
|
|
161
163
|
targetKind: "work",
|
|
162
164
|
canonicalMessageId: candidate.id,
|
|
165
|
+
// Freeze new presentation with the intent. Upgrade/retry must not reformat
|
|
166
|
+
// previously captured payloads or change Integration's content hash.
|
|
167
|
+
...(contentText === undefined ? {} : { contentText }),
|
|
163
168
|
now,
|
|
164
169
|
});
|
|
165
170
|
if (result?.created === true) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Value } from "@sinclair/typebox/value";
|
|
2
|
+
import { TaskResultRefSchema } from "@tutti/shared/schemas/api";
|
|
3
|
+
function excerpt(value, limit) {
|
|
4
|
+
const characters = [...value.trim()];
|
|
5
|
+
return characters.length <= limit
|
|
6
|
+
? characters.join("")
|
|
7
|
+
: `${characters.slice(0, limit - 1).join("")}…`;
|
|
8
|
+
}
|
|
9
|
+
/** Presentation only: never parses fallback prose or rewrites canonical results. */
|
|
10
|
+
export function platformTaskResultText(value) {
|
|
11
|
+
if (!Value.Check(TaskResultRefSchema, value))
|
|
12
|
+
return undefined;
|
|
13
|
+
const title = value.status === "completed" ? "Task completed" : "Task failed";
|
|
14
|
+
const summary = (value.status === "completed" ? value.final_note?.trim() : undefined) || value.summary.trim();
|
|
15
|
+
const parts = [title, excerpt(value.task_title, 240)];
|
|
16
|
+
if (summary !== "")
|
|
17
|
+
parts.push(excerpt(summary, 1_600));
|
|
18
|
+
// Keep discoverability of deliverables without repeating the full file inventory.
|
|
19
|
+
const files = value.generated_files ?? [];
|
|
20
|
+
if (files.length > 0) {
|
|
21
|
+
const names = files.slice(0, 3).map((file) => excerpt(file.name.replace(/\s+/gu, " "), 120));
|
|
22
|
+
parts.push(`Files: ${names.join(", ")}${files.length > 3 ? ` (+${files.length - 3})` : ""}`);
|
|
23
|
+
}
|
|
24
|
+
return parts.join("\n\n");
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=task-result-text.js.map
|
|
@@ -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">;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
2
|
import { Value } from "@sinclair/typebox/value";
|
|
3
3
|
import { IdempotencyKeySchema } from "@tutti/shared/schemas/domain";
|
|
4
|
+
import { PROJECT_TRIAL_POLICY } from "@tutti/shared/schemas/internal";
|
|
4
5
|
import { serializeRuntimeLogLine } from "@tutti/shared/utils";
|
|
5
6
|
import { NativeAuthorityTransportError } from "@tutti/relay-client";
|
|
6
7
|
import { appendHostLogLine, getHostLogFilePath } from "../cli/machine-local.js";
|
|
@@ -10,8 +11,16 @@ import { LocalConsoleOperationConflictError } from "./operation-coordinator.js";
|
|
|
10
11
|
import { LaunchError } from "../cli/errors.js";
|
|
11
12
|
import { ManagedDraftInputSchema, } from "./managed-project-service.js";
|
|
12
13
|
const ReadSchema = Type.Object({ request_ref: IdempotencyKeySchema }, { additionalProperties: false });
|
|
14
|
+
const ConfirmSchema = Type.Object({ request_ref: IdempotencyKeySchema, trial_consent: Type.Literal(PROJECT_TRIAL_POLICY) }, { additionalProperties: false });
|
|
13
15
|
export function registerLocalConsoleManagedProjectRoutes(app, options) {
|
|
14
|
-
for (const operation of [
|
|
16
|
+
for (const operation of [
|
|
17
|
+
"prepare",
|
|
18
|
+
"authorize",
|
|
19
|
+
"read",
|
|
20
|
+
"reconcile",
|
|
21
|
+
"validate",
|
|
22
|
+
"launch",
|
|
23
|
+
]) {
|
|
15
24
|
app.post(`/local-console/v1/managed-projects/${operation}`, {
|
|
16
25
|
bodyLimit: 8192,
|
|
17
26
|
errorHandler: (error, request, reply) => {
|
|
@@ -65,6 +74,11 @@ export function registerLocalConsoleManagedProjectRoutes(app, options) {
|
|
|
65
74
|
throw new ManagedLocalStateError("managed_creation_input_invalid");
|
|
66
75
|
result = await options.service.prepare(request.body, session.context);
|
|
67
76
|
}
|
|
77
|
+
else if (operation === "authorize") {
|
|
78
|
+
if (!Value.Check(ConfirmSchema, request.body))
|
|
79
|
+
throw new ManagedLocalStateError("managed_creation_input_invalid");
|
|
80
|
+
result = await options.service.authorize(request.body.request_ref, session.context, session.accountHandoff?.token);
|
|
81
|
+
}
|
|
68
82
|
else {
|
|
69
83
|
if (!Value.Check(ReadSchema, request.body))
|
|
70
84
|
throw new ManagedLocalStateError("managed_creation_input_invalid");
|
|
@@ -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;
|
|
@@ -80,13 +75,38 @@ export declare class LocalConsoleManagedProjectService {
|
|
|
80
75
|
trial_consent: "trial-project-v1";
|
|
81
76
|
};
|
|
82
77
|
};
|
|
78
|
+
authorize(requestRef: string, context: LocalConsoleInvocationContext, consoleToken?: string): Promise<{
|
|
79
|
+
draft: {
|
|
80
|
+
state: "validation_failed" | "prepared" | "registered" | "validated" | "awaiting_authorization" | "validation_unknown";
|
|
81
|
+
expires_at: string;
|
|
82
|
+
existing_project_id?: `prj_${string}`;
|
|
83
|
+
surface: "standalone" | "feishu";
|
|
84
|
+
description?: string;
|
|
85
|
+
request_ref: string;
|
|
86
|
+
project_id: `prj_${string}`;
|
|
87
|
+
display_name: string;
|
|
88
|
+
workspace_path: string;
|
|
89
|
+
};
|
|
90
|
+
relay_origin: string;
|
|
91
|
+
preparation: {
|
|
92
|
+
existing_relay_project_ref?: string;
|
|
93
|
+
expires_before?: string;
|
|
94
|
+
installation_ref: string;
|
|
95
|
+
surface: "standalone" | "feishu";
|
|
96
|
+
request_ref: string;
|
|
97
|
+
project_id: string;
|
|
98
|
+
installation_secret_hash: string;
|
|
99
|
+
handoff_token_hash: string;
|
|
100
|
+
host_registration_secret_hash: string;
|
|
101
|
+
trial_consent: "trial-project-v1";
|
|
102
|
+
};
|
|
103
|
+
}>;
|
|
83
104
|
reconcile(requestRef: string, context: LocalConsoleInvocationContext): Promise<{
|
|
84
105
|
draft: {
|
|
85
106
|
state: "validation_failed" | "prepared" | "registered" | "validated" | "awaiting_authorization" | "validation_unknown";
|
|
86
107
|
expires_at: string;
|
|
87
108
|
existing_project_id?: `prj_${string}`;
|
|
88
109
|
surface: "standalone" | "feishu";
|
|
89
|
-
tier: "light" | "high" | "max";
|
|
90
110
|
description?: string;
|
|
91
111
|
request_ref: string;
|
|
92
112
|
project_id: `prj_${string}`;
|
|
@@ -99,7 +119,6 @@ export declare class LocalConsoleManagedProjectService {
|
|
|
99
119
|
expires_before?: string;
|
|
100
120
|
installation_ref: string;
|
|
101
121
|
surface: "standalone" | "feishu";
|
|
102
|
-
tier: "light" | "high" | "max";
|
|
103
122
|
request_ref: string;
|
|
104
123
|
project_id: string;
|
|
105
124
|
installation_secret_hash: string;
|
|
@@ -112,7 +131,6 @@ export declare class LocalConsoleManagedProjectService {
|
|
|
112
131
|
validation: {
|
|
113
132
|
state: "failed" | "unknown" | "started" | "succeeded";
|
|
114
133
|
installation_ref: string;
|
|
115
|
-
tier: "light" | "high" | "max";
|
|
116
134
|
reason_code: "validation_started" | "validation_succeeded" | "validation_route_unavailable" | "validation_http_rejected" | "validation_response_invalid" | "validation_transport_unknown" | "validation_interrupted";
|
|
117
135
|
project_id: string;
|
|
118
136
|
creation_ref: string;
|
|
@@ -124,7 +142,6 @@ export declare class LocalConsoleManagedProjectService {
|
|
|
124
142
|
expires_at: string;
|
|
125
143
|
existing_project_id?: `prj_${string}`;
|
|
126
144
|
surface: "standalone" | "feishu";
|
|
127
|
-
tier: "light" | "high" | "max";
|
|
128
145
|
description?: string;
|
|
129
146
|
request_ref: string;
|
|
130
147
|
project_id: `prj_${string}`;
|
|
@@ -137,7 +154,6 @@ export declare class LocalConsoleManagedProjectService {
|
|
|
137
154
|
expires_before?: string;
|
|
138
155
|
installation_ref: string;
|
|
139
156
|
surface: "standalone" | "feishu";
|
|
140
|
-
tier: "light" | "high" | "max";
|
|
141
157
|
request_ref: string;
|
|
142
158
|
project_id: string;
|
|
143
159
|
installation_secret_hash: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Value } from "@sinclair/typebox/value";
|
|
2
|
+
import { prepareNativeConsoleAuthority } from "@tutti/relay-client";
|
|
2
3
|
import { Type } from "@sinclair/typebox";
|
|
3
4
|
import { IdempotencyKeySchema, ProjectIdSchema } from "@tutti/shared/schemas/domain";
|
|
4
|
-
import { ManagedTierSchema } from "@tutti/shared/schemas/internal";
|
|
5
5
|
import { resolveLaunchLocalContext } from "../cli/launch.js";
|
|
6
6
|
import { NativeManagedState } from "../managed-access/state.js";
|
|
7
7
|
import { findNativeManagedProject } from "../managed-access/state.js";
|
|
@@ -15,7 +15,6 @@ export const ManagedDraftInputSchema = Type.Object({
|
|
|
15
15
|
display_name: Type.String({ minLength: 1, maxLength: 80 }),
|
|
16
16
|
description: Type.Optional(Type.String({ maxLength: 160 })),
|
|
17
17
|
surface: Type.Union([Type.Literal("standalone"), Type.Literal("feishu")]),
|
|
18
|
-
tier: ManagedTierSchema,
|
|
19
18
|
existing_project_id: Type.Optional(ProjectIdSchema),
|
|
20
19
|
}, { additionalProperties: false });
|
|
21
20
|
function projection(row) {
|
|
@@ -26,7 +25,6 @@ function projection(row) {
|
|
|
26
25
|
workspace_path: row.workspace_root,
|
|
27
26
|
...(row.description === undefined ? {} : { description: row.description }),
|
|
28
27
|
surface: row.surface,
|
|
29
|
-
tier: row.tier,
|
|
30
28
|
...(row.existing_relay_project_ref === undefined
|
|
31
29
|
? {}
|
|
32
30
|
: { existing_project_id: row.project_id }),
|
|
@@ -80,8 +78,7 @@ export class LocalConsoleManagedProjectService {
|
|
|
80
78
|
relayUrl: state.origin,
|
|
81
79
|
projectId: input.existing_project_id,
|
|
82
80
|
});
|
|
83
|
-
if (previous !== null &&
|
|
84
|
-
(previous.journal.state !== "registered" || previous.journal.tier !== input.tier))
|
|
81
|
+
if (previous !== null && previous.journal.state !== "registered")
|
|
85
82
|
throw new ManagedLocalStateError("managed_reauthorization_conflict");
|
|
86
83
|
existing = {
|
|
87
84
|
...target,
|
|
@@ -94,7 +91,6 @@ export class LocalConsoleManagedProjectService {
|
|
|
94
91
|
displayName: input.display_name.trim(),
|
|
95
92
|
...(input.description === undefined ? {} : { description: input.description.trim() }),
|
|
96
93
|
surface: input.surface,
|
|
97
|
-
tier: input.tier,
|
|
98
94
|
...(existing === undefined ? {} : { projectId: input.existing_project_id, existing }),
|
|
99
95
|
now: this.options.now?.() ?? new Date(),
|
|
100
96
|
});
|
|
@@ -113,6 +109,26 @@ export class LocalConsoleManagedProjectService {
|
|
|
113
109
|
preparation: state.preparationBody(requestRef),
|
|
114
110
|
};
|
|
115
111
|
}
|
|
112
|
+
async authorize(requestRef, context, consoleToken) {
|
|
113
|
+
return this.options.operations.runProjectOperation(async () => {
|
|
114
|
+
if (!consoleToken)
|
|
115
|
+
throw new ManagedLocalStateError("console_setup_access_invalid");
|
|
116
|
+
const state = this.state(context);
|
|
117
|
+
await prepareNativeConsoleAuthority({
|
|
118
|
+
relayUrl: state.origin,
|
|
119
|
+
body: { console_token: consoleToken, preparation: state.preparationBody(requestRef) },
|
|
120
|
+
...(this.options.fetchImpl === undefined ? {} : { fetchImpl: this.options.fetchImpl }),
|
|
121
|
+
});
|
|
122
|
+
// Never advance the journal from the setup receipt alone: prove the exact native binding.
|
|
123
|
+
await reconcileNativePreparation({
|
|
124
|
+
state,
|
|
125
|
+
requestRef,
|
|
126
|
+
now: this.options.now?.() ?? new Date(),
|
|
127
|
+
...(this.options.fetchImpl === undefined ? {} : { fetchImpl: this.options.fetchImpl }),
|
|
128
|
+
});
|
|
129
|
+
return this.read(requestRef, context);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
116
132
|
async reconcile(requestRef, context) {
|
|
117
133
|
return this.options.operations.runProjectOperation(async () => {
|
|
118
134
|
const state = this.state(context);
|
|
@@ -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
|
-
?
|
|
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,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
|
|
@@ -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
|
-
"
|
|
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"
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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,
|
|
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(
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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,
|
|
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(
|
|
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",
|