@dharta/cli 0.6.77 → 0.6.78
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/LICENSE +1 -1
- package/README.md +215 -11
- package/dist/agent.js +3 -2
- package/dist/agent.js.map +1 -1
- package/dist/api-error.js +6 -6
- package/dist/api-error.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +860 -149
- package/dist/cli.js.map +1 -1
- package/dist/command-tree.d.ts +3 -0
- package/dist/command-tree.js +10 -0
- package/dist/command-tree.js.map +1 -0
- package/dist/commands/agents.d.ts +54 -17
- package/dist/commands/agents.js +246 -136
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/analytics.js +6 -5
- package/dist/commands/analytics.js.map +1 -1
- package/dist/commands/api.js +71 -86
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/appearance.js +5 -6
- package/dist/commands/appearance.js.map +1 -1
- package/dist/commands/artifact.js +7 -6
- package/dist/commands/artifact.js.map +1 -1
- package/dist/commands/audit-log.js +2 -1
- package/dist/commands/audit-log.js.map +1 -1
- package/dist/commands/auth.js +26 -6
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/caps.js +11 -15
- package/dist/commands/caps.js.map +1 -1
- package/dist/commands/deploy.js +25 -10
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +10 -1
- package/dist/commands/dev.js +56 -25
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +60 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/embed-keys.js +4 -13
- package/dist/commands/embed-keys.js.map +1 -1
- package/dist/commands/env.js +4 -7
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/files.js +3 -4
- package/dist/commands/files.js.map +1 -1
- package/dist/commands/fleet.d.ts +129 -0
- package/dist/commands/fleet.js +408 -0
- package/dist/commands/fleet.js.map +1 -0
- package/dist/commands/genui.d.ts +2 -0
- package/dist/commands/genui.js +53 -0
- package/dist/commands/genui.js.map +1 -0
- package/dist/commands/git-credential.js +2 -3
- package/dist/commands/git-credential.js.map +1 -1
- package/dist/commands/kartas.d.ts +9 -0
- package/dist/commands/kartas.js +33 -11
- package/dist/commands/kartas.js.map +1 -1
- package/dist/commands/keys.d.ts +17 -18
- package/dist/commands/keys.js +108 -19
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/login.js +2 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/members.d.ts +10 -0
- package/dist/commands/members.js +20 -6
- package/dist/commands/members.js.map +1 -1
- package/dist/commands/model-connections.d.ts +44 -0
- package/dist/commands/model-connections.js +435 -0
- package/dist/commands/model-connections.js.map +1 -0
- package/dist/commands/open.d.ts +2 -2
- package/dist/commands/open.js +4 -3
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/org.d.ts +9 -0
- package/dist/commands/org.js +42 -0
- package/dist/commands/org.js.map +1 -0
- package/dist/commands/organization.d.ts +16 -0
- package/dist/commands/organization.js +118 -0
- package/dist/commands/organization.js.map +1 -0
- package/dist/commands/parity.js +1 -3
- package/dist/commands/parity.js.map +1 -1
- package/dist/commands/repos.d.ts +4 -0
- package/dist/commands/repos.js +17 -0
- package/dist/commands/repos.js.map +1 -0
- package/dist/commands/rollback.js +2 -3
- package/dist/commands/rollback.js.map +1 -1
- package/dist/commands/schedules.js +26 -21
- package/dist/commands/schedules.js.map +1 -1
- package/dist/commands/scopes.js +8 -1
- package/dist/commands/scopes.js.map +1 -1
- package/dist/commands/sessions.js +9 -3
- package/dist/commands/sessions.js.map +1 -1
- package/dist/commands/setup.js +5 -4
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.js +24 -11
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/webhooks.d.ts +4 -1
- package/dist/commands/webhooks.js +21 -16
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/completions.js +24 -13
- package/dist/completions.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.js +121 -7
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +2 -0
- package/dist/context.js +23 -7
- package/dist/context.js.map +1 -1
- package/dist/docs/cli-reference.d.ts +2 -0
- package/dist/docs/cli-reference.js +191 -0
- package/dist/docs/cli-reference.js.map +1 -0
- package/dist/exit-codes.d.ts +25 -0
- package/dist/exit-codes.js +107 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/genui.d.ts +178 -0
- package/dist/genui.js +1130 -0
- package/dist/genui.js.map +1 -0
- package/dist/harnesses.js +2 -1
- package/dist/harnesses.js.map +1 -1
- package/dist/jq.d.ts +4 -0
- package/dist/jq.js +91 -0
- package/dist/jq.js.map +1 -0
- package/dist/login-offer.js +6 -2
- package/dist/login-offer.js.map +1 -1
- package/dist/manifest.d.ts +12 -0
- package/dist/manifest.js +126 -0
- package/dist/manifest.js.map +1 -1
- package/dist/model-auth.d.ts +29 -0
- package/dist/model-auth.js +117 -0
- package/dist/model-auth.js.map +1 -0
- package/dist/model-settings.d.ts +23 -0
- package/dist/model-settings.js +186 -0
- package/dist/model-settings.js.map +1 -0
- package/dist/money.js +2 -1
- package/dist/money.js.map +1 -1
- package/dist/output.d.ts +6 -0
- package/dist/output.js +54 -0
- package/dist/output.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/scaffold.js +2 -1
- package/dist/scaffold.js.map +1 -1
- package/dist/validators.js +17 -11
- package/dist/validators.js.map +1 -1
- package/dist/version-check.d.ts +1 -1
- package/dist/version-check.js +1 -1
- package/dist/version-check.js.map +1 -1
- package/node_modules/@dharta/contracts/LICENSE +21 -0
- package/node_modules/@dharta/contracts/README.md +45 -0
- package/node_modules/@dharta/contracts/artifact-runtime.json +750 -0
- package/node_modules/@dharta/contracts/dist/activity.d.ts +62 -0
- package/node_modules/@dharta/contracts/dist/activity.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/activity.js +178 -0
- package/node_modules/@dharta/contracts/dist/activity.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.d.ts +20 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.js +53 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-formats.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.d.ts +37 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.js +5107 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime-validators.generated.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.d.ts +154 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.d.ts +1670 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.js +1903 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.generated.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.js +377 -0
- package/node_modules/@dharta/contracts/dist/artifact-runtime.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/index.d.ts +6 -0
- package/node_modules/@dharta/contracts/dist/index.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/index.js +6 -0
- package/node_modules/@dharta/contracts/dist/index.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/model-auth.d.ts +31 -0
- package/node_modules/@dharta/contracts/dist/model-auth.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/model-auth.js +45 -0
- package/node_modules/@dharta/contracts/dist/model-auth.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/tasks.d.ts +44 -0
- package/node_modules/@dharta/contracts/dist/tasks.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/tasks.js +127 -0
- package/node_modules/@dharta/contracts/dist/tasks.js.map +1 -0
- package/node_modules/@dharta/contracts/dist/wire-events.d.ts +71 -0
- package/node_modules/@dharta/contracts/dist/wire-events.d.ts.map +1 -0
- package/node_modules/@dharta/contracts/dist/wire-events.js +48 -0
- package/node_modules/@dharta/contracts/dist/wire-events.js.map +1 -0
- package/node_modules/@dharta/contracts/model-auth-capabilities-v1.json +168 -0
- package/node_modules/@dharta/contracts/model-auth-reasons-v1.json +38 -0
- package/node_modules/@dharta/contracts/package.json +44 -0
- package/node_modules/@dharta/contracts/src/activity.ts +215 -0
- package/node_modules/@dharta/contracts/src/artifact-runtime-formats.ts +54 -0
- package/node_modules/@dharta/contracts/src/artifact-runtime-validators.generated.ts +29 -0
- package/node_modules/@dharta/contracts/src/artifact-runtime.generated.ts +2093 -0
- package/node_modules/@dharta/contracts/src/artifact-runtime.ts +520 -0
- package/node_modules/@dharta/contracts/src/index.ts +5 -0
- package/node_modules/@dharta/contracts/src/model-auth.ts +82 -0
- package/node_modules/@dharta/contracts/src/tasks.ts +142 -0
- package/node_modules/@dharta/contracts/src/wire-events.ts +150 -0
- package/node_modules/@dharta/contracts/wire-events.json +29 -0
- package/node_modules/@dharta/sdk/LICENSE +1 -1
- package/node_modules/@dharta/sdk/README.md +22 -8
- package/node_modules/@dharta/sdk/dist/errors.d.ts +9 -7
- package/node_modules/@dharta/sdk/dist/errors.d.ts.map +1 -1
- package/node_modules/@dharta/sdk/dist/errors.js +36 -18
- package/node_modules/@dharta/sdk/dist/errors.js.map +1 -1
- package/node_modules/@dharta/sdk/dist/fleet.d.ts +69 -0
- package/node_modules/@dharta/sdk/dist/fleet.d.ts.map +1 -0
- package/node_modules/@dharta/sdk/dist/fleet.js +240 -0
- package/node_modules/@dharta/sdk/dist/fleet.js.map +1 -0
- package/node_modules/@dharta/sdk/dist/http.d.ts +6 -2
- package/node_modules/@dharta/sdk/dist/http.d.ts.map +1 -1
- package/node_modules/@dharta/sdk/dist/http.js +71 -12
- package/node_modules/@dharta/sdk/dist/http.js.map +1 -1
- package/node_modules/@dharta/sdk/dist/idempotency.d.ts +12 -0
- package/node_modules/@dharta/sdk/dist/idempotency.d.ts.map +1 -0
- package/node_modules/@dharta/sdk/dist/idempotency.js +72 -0
- package/node_modules/@dharta/sdk/dist/idempotency.js.map +1 -0
- package/node_modules/@dharta/sdk/dist/index.d.ts +20 -6
- package/node_modules/@dharta/sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@dharta/sdk/dist/index.js +27 -4
- package/node_modules/@dharta/sdk/dist/index.js.map +1 -1
- package/node_modules/@dharta/sdk/dist/resources.d.ts +108 -13
- package/node_modules/@dharta/sdk/dist/resources.d.ts.map +1 -1
- package/node_modules/@dharta/sdk/dist/resources.js +403 -57
- package/node_modules/@dharta/sdk/dist/resources.js.map +1 -1
- package/node_modules/@dharta/sdk/dist/types.d.ts +436 -16
- package/node_modules/@dharta/sdk/dist/types.d.ts.map +1 -1
- package/node_modules/@dharta/sdk/dist/types.js +31 -2
- package/node_modules/@dharta/sdk/dist/types.js.map +1 -1
- package/node_modules/@dharta/sdk/package.json +9 -3
- package/node_modules/@dharta/sdk/src/errors.ts +41 -18
- package/node_modules/@dharta/sdk/src/fleet.ts +339 -0
- package/node_modules/@dharta/sdk/src/http.ts +110 -17
- package/node_modules/@dharta/sdk/src/idempotency.ts +101 -0
- package/node_modules/@dharta/sdk/src/index.ts +50 -11
- package/node_modules/@dharta/sdk/src/resources.ts +549 -68
- package/node_modules/@dharta/sdk/src/types.ts +629 -20
- package/package.json +16 -6
- package/src/agent.ts +3 -2
- package/src/api-error.ts +6 -5
- package/src/cli.ts +978 -163
- package/src/command-tree.ts +13 -0
- package/src/commands/agents.ts +365 -167
- package/src/commands/analytics.ts +6 -5
- package/src/commands/api.ts +73 -92
- package/src/commands/appearance.ts +5 -6
- package/src/commands/artifact.ts +7 -6
- package/src/commands/audit-log.ts +2 -1
- package/src/commands/auth.ts +25 -5
- package/src/commands/caps.ts +11 -15
- package/src/commands/deploy.ts +18 -4
- package/src/commands/dev.ts +86 -25
- package/src/commands/doctor.ts +69 -0
- package/src/commands/embed-keys.ts +4 -14
- package/src/commands/env.ts +4 -7
- package/src/commands/files.ts +3 -4
- package/src/commands/fleet.ts +672 -0
- package/src/commands/genui.ts +59 -0
- package/src/commands/git-credential.ts +2 -3
- package/src/commands/kartas.ts +45 -11
- package/src/commands/keys.ts +152 -35
- package/src/commands/login.ts +2 -1
- package/src/commands/members.ts +31 -6
- package/src/commands/model-connections.ts +547 -0
- package/src/commands/open.ts +5 -4
- package/src/commands/org.ts +57 -0
- package/src/commands/organization.ts +153 -0
- package/src/commands/parity.ts +1 -3
- package/src/commands/repos.ts +23 -0
- package/src/commands/rollback.ts +2 -3
- package/src/commands/schedules.ts +33 -22
- package/src/commands/scopes.ts +8 -1
- package/src/commands/sessions.ts +9 -3
- package/src/commands/setup.ts +5 -4
- package/src/commands/update.ts +28 -12
- package/src/commands/webhooks.ts +30 -19
- package/src/completions.ts +25 -13
- package/src/config.ts +141 -9
- package/src/context.ts +34 -7
- package/src/docs/cli-reference.ts +206 -0
- package/src/exit-codes.ts +122 -0
- package/src/genui.ts +1398 -0
- package/src/harnesses.ts +2 -1
- package/src/jq.ts +109 -0
- package/src/login-offer.ts +6 -2
- package/src/manifest.ts +134 -0
- package/src/model-auth.ts +173 -0
- package/src/model-settings.ts +222 -0
- package/src/money.ts +5 -1
- package/src/output.ts +60 -0
- package/src/runtime.ts +1 -1
- package/src/scaffold.ts +2 -1
- package/src/validators.ts +18 -11
- package/src/version-check.ts +1 -1
- package/dist/commands/model-keys.d.ts +0 -22
- package/dist/commands/model-keys.js +0 -222
- package/dist/commands/model-keys.js.map +0 -1
- package/src/commands/model-keys.ts +0 -278
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/** RFC 0065 durable background-task wire contract (snake_case, server -> consumer). */
|
|
2
|
+
export const SESSION_TASK_KINDS = ["command", "workflow", "subagent", "other"];
|
|
3
|
+
export const SESSION_TASK_STATUSES = [
|
|
4
|
+
"queued", "running", "succeeded", "failed", "cancelled", "interrupted",
|
|
5
|
+
];
|
|
6
|
+
export const SESSION_TASK_LIMITS = {
|
|
7
|
+
idChars: 128,
|
|
8
|
+
labelChars: 240,
|
|
9
|
+
progressUnitChars: 48,
|
|
10
|
+
errorCodeChars: 128,
|
|
11
|
+
};
|
|
12
|
+
const KIND_SET = new Set(SESSION_TASK_KINDS);
|
|
13
|
+
const STATUS_SET = new Set(SESSION_TASK_STATUSES);
|
|
14
|
+
/** Validate an untrusted task projection before exposing it through the SDK. */
|
|
15
|
+
export function parseSessionTaskWire(value) {
|
|
16
|
+
if (!isRecord(value) || value.schema_version !== 1)
|
|
17
|
+
return null;
|
|
18
|
+
if (!boundedString(value.task_id, SESSION_TASK_LIMITS.idChars))
|
|
19
|
+
return null;
|
|
20
|
+
if (!boundedString(value.session_id, SESSION_TASK_LIMITS.idChars))
|
|
21
|
+
return null;
|
|
22
|
+
if (!KIND_SET.has(String(value.kind)) || !STATUS_SET.has(String(value.status)))
|
|
23
|
+
return null;
|
|
24
|
+
if (!boundedString(value.label, SESSION_TASK_LIMITS.labelChars))
|
|
25
|
+
return null;
|
|
26
|
+
if (typeof value.cancelable !== "boolean")
|
|
27
|
+
return null;
|
|
28
|
+
if (value.turn_id !== undefined && !boundedString(value.turn_id, SESSION_TASK_LIMITS.idChars))
|
|
29
|
+
return null;
|
|
30
|
+
if (value.parent_task_id !== undefined && !boundedString(value.parent_task_id, SESSION_TASK_LIMITS.idChars))
|
|
31
|
+
return null;
|
|
32
|
+
if (value.started_at !== undefined && !validTimestamp(value.started_at))
|
|
33
|
+
return null;
|
|
34
|
+
if (value.completed_at !== undefined && !validTimestamp(value.completed_at))
|
|
35
|
+
return null;
|
|
36
|
+
if (value.error_code !== undefined && !boundedString(value.error_code, SESSION_TASK_LIMITS.errorCodeChars))
|
|
37
|
+
return null;
|
|
38
|
+
const progress = parseProgress(value.progress);
|
|
39
|
+
if (value.progress !== undefined && progress === null)
|
|
40
|
+
return null;
|
|
41
|
+
const usage = parseUsage(value.usage);
|
|
42
|
+
if (value.usage !== undefined && usage === null)
|
|
43
|
+
return null;
|
|
44
|
+
const anchor = parseAnchor(value.transcript_anchor);
|
|
45
|
+
if (value.transcript_anchor !== undefined && anchor === null)
|
|
46
|
+
return null;
|
|
47
|
+
if (value.tool_uses !== undefined && !nonNegativeInteger(value.tool_uses))
|
|
48
|
+
return null;
|
|
49
|
+
return {
|
|
50
|
+
schema_version: 1,
|
|
51
|
+
task_id: value.task_id,
|
|
52
|
+
session_id: value.session_id,
|
|
53
|
+
...(value.turn_id !== undefined ? { turn_id: value.turn_id } : {}),
|
|
54
|
+
...(value.parent_task_id !== undefined ? { parent_task_id: value.parent_task_id } : {}),
|
|
55
|
+
kind: value.kind,
|
|
56
|
+
label: value.label,
|
|
57
|
+
status: value.status,
|
|
58
|
+
...(value.started_at !== undefined ? { started_at: value.started_at } : {}),
|
|
59
|
+
...(value.completed_at !== undefined ? { completed_at: value.completed_at } : {}),
|
|
60
|
+
...(progress ? { progress } : {}),
|
|
61
|
+
...(usage ? { usage } : {}),
|
|
62
|
+
...(value.tool_uses !== undefined ? { tool_uses: value.tool_uses } : {}),
|
|
63
|
+
...(anchor ? { transcript_anchor: anchor } : {}),
|
|
64
|
+
cancelable: value.cancelable,
|
|
65
|
+
...(value.error_code !== undefined ? { error_code: value.error_code } : {}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function parseProgress(value) {
|
|
69
|
+
if (value === undefined)
|
|
70
|
+
return null;
|
|
71
|
+
if (!isRecord(value))
|
|
72
|
+
return null;
|
|
73
|
+
if (value.completed !== undefined && !nonNegativeNumber(value.completed))
|
|
74
|
+
return null;
|
|
75
|
+
if (value.total !== undefined && !nonNegativeNumber(value.total))
|
|
76
|
+
return null;
|
|
77
|
+
if (value.unit !== undefined && !boundedString(value.unit, SESSION_TASK_LIMITS.progressUnitChars))
|
|
78
|
+
return null;
|
|
79
|
+
return {
|
|
80
|
+
...(value.completed !== undefined ? { completed: value.completed } : {}),
|
|
81
|
+
...(value.total !== undefined ? { total: value.total } : {}),
|
|
82
|
+
...(value.unit !== undefined ? { unit: value.unit } : {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function parseUsage(value) {
|
|
86
|
+
if (value === undefined)
|
|
87
|
+
return null;
|
|
88
|
+
if (!isRecord(value))
|
|
89
|
+
return null;
|
|
90
|
+
const output = {};
|
|
91
|
+
for (const key of ["input_tokens", "output_tokens", "total_tokens"]) {
|
|
92
|
+
if (value[key] !== undefined) {
|
|
93
|
+
if (!nonNegativeInteger(value[key]))
|
|
94
|
+
return null;
|
|
95
|
+
output[key] = value[key];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return output;
|
|
99
|
+
}
|
|
100
|
+
function parseAnchor(value) {
|
|
101
|
+
if (value === undefined)
|
|
102
|
+
return null;
|
|
103
|
+
if (!isRecord(value) || !boundedString(value.message_id, SESSION_TASK_LIMITS.idChars))
|
|
104
|
+
return null;
|
|
105
|
+
if (value.activity_id !== undefined && !boundedString(value.activity_id, SESSION_TASK_LIMITS.idChars))
|
|
106
|
+
return null;
|
|
107
|
+
return {
|
|
108
|
+
message_id: value.message_id,
|
|
109
|
+
...(value.activity_id !== undefined ? { activity_id: value.activity_id } : {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function validTimestamp(value) {
|
|
113
|
+
return boundedString(value, 64) && Number.isFinite(Date.parse(value));
|
|
114
|
+
}
|
|
115
|
+
function boundedString(value, max) {
|
|
116
|
+
return typeof value === "string" && value.length > 0 && value.length <= max;
|
|
117
|
+
}
|
|
118
|
+
function nonNegativeInteger(value) {
|
|
119
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
120
|
+
}
|
|
121
|
+
function nonNegativeNumber(value) {
|
|
122
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
123
|
+
}
|
|
124
|
+
function isRecord(value) {
|
|
125
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa;CAC9D,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,GAAG;IACZ,UAAU,EAAE,GAAG;IACf,iBAAiB,EAAE,EAAE;IACrB,cAAc,EAAE,GAAG;CACX,CAAC;AA8BX,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,kBAAkB,CAAC,CAAC;AACrD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAS,qBAAqB,CAAC,CAAC;AAE1D,gFAAgF;AAChF,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAChE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5E,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,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,WAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzF,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CAAC,KAAc,EAAE,GAAW;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC;AAC9E,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAK,KAAgB,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ActivityPresentationWire } from "./activity.js";
|
|
2
|
+
import type { SessionTaskWire } from "./tasks.js";
|
|
3
|
+
/**
|
|
4
|
+
* Managed-Agents adapter event types (the default, full-fidelity stream).
|
|
5
|
+
* Keep in sync with `wire-events.json` (the language-neutral source of truth a
|
|
6
|
+
* test asserts against) and the Python `MANAGED_AGENT_EVENT_TYPES`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MANAGED_AGENT_EVENT_TYPES: readonly ["session.status_running", "session.trace", "session.warming", "agent.message", "agent.thinking", "agent.activity", "agent.tool_use", "agent.tool_result", "session.usage", "session.status_idle", "session.error", "session.warning", "session.message_queued", "session.message_dequeued", "session.task_started", "session.task_updated", "session.task_completed", "artifact.committed"];
|
|
9
|
+
export type ManagedAgentEventType = (typeof MANAGED_AGENT_EVENT_TYPES)[number];
|
|
10
|
+
/** Responses adapter event types (the portable OpenAI-compatible fallback). */
|
|
11
|
+
export declare const RESPONSES_EVENT_TYPES: readonly ["response.created", "response.output_text.delta", "response.completed", "response.failed"];
|
|
12
|
+
export type ResponsesEventType = (typeof RESPONSES_EVENT_TYPES)[number];
|
|
13
|
+
export type TurnFailurePhase = "admission" | "resolution" | "dispatch" | "streaming" | "finalization" | "continuation";
|
|
14
|
+
export type TurnFailureRemediation = "retry" | "retry_turn" | "reconnect_model" | "select_model_funding" | "start_new_session" | "wait_and_retry" | "contact_support" | "none";
|
|
15
|
+
export interface TurnFailureWire {
|
|
16
|
+
code?: string;
|
|
17
|
+
message?: string;
|
|
18
|
+
retryable?: boolean;
|
|
19
|
+
phase?: TurnFailurePhase;
|
|
20
|
+
remediation?: TurnFailureRemediation;
|
|
21
|
+
request_id?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A raw Managed-Agents SSE event, decoded from `event:<type>\ndata:{...}`. A
|
|
25
|
+
* flat bag of optional fields because which ones are present depends on `type`
|
|
26
|
+
* (see MANAGED_AGENT_EVENT_TYPES); the consumer narrows on `type`.
|
|
27
|
+
*/
|
|
28
|
+
export interface ManagedAgentWireEvent extends TurnFailureWire {
|
|
29
|
+
type: string;
|
|
30
|
+
seq?: number;
|
|
31
|
+
text?: string;
|
|
32
|
+
part_id?: string;
|
|
33
|
+
delta?: boolean;
|
|
34
|
+
tool?: string;
|
|
35
|
+
tool_use_id?: string;
|
|
36
|
+
input?: unknown;
|
|
37
|
+
output?: unknown;
|
|
38
|
+
is_error?: boolean;
|
|
39
|
+
_meta?: unknown;
|
|
40
|
+
stop_reason?: string;
|
|
41
|
+
request_id?: string;
|
|
42
|
+
kind?: string;
|
|
43
|
+
target?: string;
|
|
44
|
+
options?: unknown;
|
|
45
|
+
questions?: unknown;
|
|
46
|
+
usage?: Record<string, unknown>;
|
|
47
|
+
turn_id?: string;
|
|
48
|
+
started_at?: string;
|
|
49
|
+
observed_at?: string;
|
|
50
|
+
completed_at?: string;
|
|
51
|
+
trace_id?: string;
|
|
52
|
+
queue_id?: string;
|
|
53
|
+
queued_at?: string;
|
|
54
|
+
mode?: string;
|
|
55
|
+
artifact?: Record<string, unknown>;
|
|
56
|
+
activity?: ActivityPresentationWire;
|
|
57
|
+
task?: SessionTaskWire;
|
|
58
|
+
task_seq?: number;
|
|
59
|
+
version?: number;
|
|
60
|
+
}
|
|
61
|
+
/** A raw Responses-adapter SSE event (OpenAI-compatible response stream). */
|
|
62
|
+
export interface ResponsesWireEvent {
|
|
63
|
+
type: string;
|
|
64
|
+
delta?: string;
|
|
65
|
+
response?: {
|
|
66
|
+
id?: string;
|
|
67
|
+
usage?: Record<string, unknown>;
|
|
68
|
+
error?: TurnFailureWire;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=wire-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-events.d.ts","sourceRoot":"","sources":["../src/wire-events.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,YACpC,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,eAAe,EAGf,iBAAiB,EAIjB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,CACZ,CAAC;AA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EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAIlB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGnC,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,eAAe,CAAC;KACzB,CAAC;CACH"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The canonical data-plane SSE wire-event vocabulary: the `event:` type strings
|
|
2
|
+
// the Dharta data plane emits over the streaming turn endpoint, plus the raw
|
|
3
|
+
// `data` shapes a client decodes. This is the cross-plane contract - the Python
|
|
4
|
+
// data plane emits these, the TypeScript widget consumes them, and a conformance
|
|
5
|
+
// test on each side pins both against `wire-events.json` so they cannot drift.
|
|
6
|
+
//
|
|
7
|
+
// These are the RAW wire shapes (snake_case, flat optional bags), not the
|
|
8
|
+
// widget's normalized client-facing `AgentEvent`. The widget maps wire -> normal
|
|
9
|
+
// in its transport layer; that normalization is widget-internal and not part of
|
|
10
|
+
// this contract.
|
|
11
|
+
/**
|
|
12
|
+
* Managed-Agents adapter event types (the default, full-fidelity stream).
|
|
13
|
+
* Keep in sync with `wire-events.json` (the language-neutral source of truth a
|
|
14
|
+
* test asserts against) and the Python `MANAGED_AGENT_EVENT_TYPES`.
|
|
15
|
+
*/
|
|
16
|
+
export const MANAGED_AGENT_EVENT_TYPES = [
|
|
17
|
+
"session.status_running",
|
|
18
|
+
"session.trace",
|
|
19
|
+
"session.warming",
|
|
20
|
+
"agent.message",
|
|
21
|
+
"agent.thinking",
|
|
22
|
+
"agent.activity",
|
|
23
|
+
"agent.tool_use",
|
|
24
|
+
"agent.tool_result",
|
|
25
|
+
"session.usage",
|
|
26
|
+
"session.status_idle",
|
|
27
|
+
"session.error",
|
|
28
|
+
// RFC 0060 H2: a non-terminal session-level warning (e.g. the post-turn durable snapshot
|
|
29
|
+
// was refused at the storage hard cap, so recent changes were not saved).
|
|
30
|
+
"session.warning",
|
|
31
|
+
// Session message inbox: a user.message posted mid-turn is queued (never 409ed).
|
|
32
|
+
// message_dequeued's `mode` is "steered" (injected into the live turn) or "turn"
|
|
33
|
+
// (it began the next turn, incl. inbox drain at turn end). Both non-terminal.
|
|
34
|
+
"session.message_queued",
|
|
35
|
+
"session.message_dequeued",
|
|
36
|
+
"session.task_started",
|
|
37
|
+
"session.task_updated",
|
|
38
|
+
"session.task_completed",
|
|
39
|
+
"artifact.committed",
|
|
40
|
+
];
|
|
41
|
+
/** Responses adapter event types (the portable OpenAI-compatible fallback). */
|
|
42
|
+
export const RESPONSES_EVENT_TYPES = [
|
|
43
|
+
"response.created",
|
|
44
|
+
"response.output_text.delta",
|
|
45
|
+
"response.completed",
|
|
46
|
+
"response.failed",
|
|
47
|
+
];
|
|
48
|
+
//# sourceMappingURL=wire-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-events.js","sourceRoot":"","sources":["../src/wire-events.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,EAAE;AACF,0EAA0E;AAC1E,iFAAiF;AACjF,gFAAgF;AAChF,iBAAiB;AAKjB;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,wBAAwB;IACxB,eAAe;IACf,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,eAAe;IACf,qBAAqB;IACrB,eAAe;IACf,yFAAyF;IACzF,0EAA0E;IAC1E,iBAAiB;IACjB,iFAAiF;IACjF,iFAAiF;IACjF,8EAA8E;IAC9E,wBAAwB;IACxB,0BAA0B;IAC1B,sBAAsB;IACtB,sBAAsB;IACtB,wBAAwB;IACxB,oBAAoB;CACZ,CAAC;AAIX,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,kBAAkB;IAClB,4BAA4B;IAC5B,oBAAoB;IACpB,iBAAiB;CACT,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"credential_kinds": [
|
|
4
|
+
"api_key",
|
|
5
|
+
"oauth_session",
|
|
6
|
+
"provider_managed_session",
|
|
7
|
+
"workload_identity"
|
|
8
|
+
],
|
|
9
|
+
"funding_sources": [
|
|
10
|
+
"api_usage",
|
|
11
|
+
"subscription_entitlement",
|
|
12
|
+
"enterprise_entitlement",
|
|
13
|
+
"platform"
|
|
14
|
+
],
|
|
15
|
+
"owner_kinds": [
|
|
16
|
+
"organization",
|
|
17
|
+
"individual",
|
|
18
|
+
"install",
|
|
19
|
+
"platform"
|
|
20
|
+
],
|
|
21
|
+
"storage_kinds": [
|
|
22
|
+
"control_plane_encrypted",
|
|
23
|
+
"install_local_ref",
|
|
24
|
+
"os_keyring",
|
|
25
|
+
"provider_client_owned"
|
|
26
|
+
],
|
|
27
|
+
"execution_scopes": [
|
|
28
|
+
"local",
|
|
29
|
+
"private_interactive",
|
|
30
|
+
"background",
|
|
31
|
+
"shared",
|
|
32
|
+
"public"
|
|
33
|
+
],
|
|
34
|
+
"capabilities": [
|
|
35
|
+
{
|
|
36
|
+
"id": "anthropic_api_key",
|
|
37
|
+
"provider": "anthropic",
|
|
38
|
+
"credential_kind": "api_key",
|
|
39
|
+
"funding_source": "api_usage",
|
|
40
|
+
"owner_kinds": ["organization", "individual"],
|
|
41
|
+
"storage_kinds": ["control_plane_encrypted", "install_local_ref", "os_keyring"],
|
|
42
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
43
|
+
"admission": "enabled",
|
|
44
|
+
"runtime_switch": "anthropic_api_key",
|
|
45
|
+
"adapter": "anthropic_api_key"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "openai_api_key",
|
|
49
|
+
"provider": "openai",
|
|
50
|
+
"credential_kind": "api_key",
|
|
51
|
+
"funding_source": "api_usage",
|
|
52
|
+
"owner_kinds": ["organization", "individual"],
|
|
53
|
+
"storage_kinds": ["control_plane_encrypted", "install_local_ref", "os_keyring"],
|
|
54
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
55
|
+
"admission": "enabled",
|
|
56
|
+
"runtime_switch": "openai_api_key",
|
|
57
|
+
"adapter": "openai_api_key"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "openrouter_api_key",
|
|
61
|
+
"provider": "openrouter",
|
|
62
|
+
"credential_kind": "api_key",
|
|
63
|
+
"funding_source": "api_usage",
|
|
64
|
+
"owner_kinds": ["organization", "individual"],
|
|
65
|
+
"storage_kinds": ["control_plane_encrypted", "install_local_ref", "os_keyring"],
|
|
66
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
67
|
+
"admission": "enabled",
|
|
68
|
+
"runtime_switch": "openrouter_api_key",
|
|
69
|
+
"adapter": "openrouter_api_key"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "xai_api_key",
|
|
73
|
+
"provider": "xai",
|
|
74
|
+
"credential_kind": "api_key",
|
|
75
|
+
"funding_source": "api_usage",
|
|
76
|
+
"owner_kinds": ["organization", "individual"],
|
|
77
|
+
"storage_kinds": ["control_plane_encrypted", "install_local_ref", "os_keyring"],
|
|
78
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
79
|
+
"admission": "enabled",
|
|
80
|
+
"runtime_switch": "xai_api_key",
|
|
81
|
+
"adapter": "xai_api_key"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "google_api_key",
|
|
85
|
+
"provider": "google",
|
|
86
|
+
"credential_kind": "api_key",
|
|
87
|
+
"funding_source": "api_usage",
|
|
88
|
+
"owner_kinds": ["organization", "individual"],
|
|
89
|
+
"storage_kinds": ["control_plane_encrypted", "install_local_ref", "os_keyring"],
|
|
90
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
91
|
+
"admission": "enabled",
|
|
92
|
+
"runtime_switch": "google_api_key",
|
|
93
|
+
"adapter": "google_api_key"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "bedrock_workload_identity",
|
|
97
|
+
"provider": "bedrock",
|
|
98
|
+
"credential_kind": "workload_identity",
|
|
99
|
+
"funding_source": "platform",
|
|
100
|
+
"owner_kinds": ["platform"],
|
|
101
|
+
"storage_kinds": ["provider_client_owned"],
|
|
102
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
103
|
+
"admission": "enabled",
|
|
104
|
+
"runtime_switch": "bedrock_workload_identity",
|
|
105
|
+
"adapter": "bedrock_workload_identity"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "vertex_workload_identity",
|
|
109
|
+
"provider": "vertex",
|
|
110
|
+
"credential_kind": "workload_identity",
|
|
111
|
+
"funding_source": "platform",
|
|
112
|
+
"owner_kinds": ["platform"],
|
|
113
|
+
"storage_kinds": ["provider_client_owned"],
|
|
114
|
+
"execution_scopes": ["local", "private_interactive", "background", "shared", "public"],
|
|
115
|
+
"admission": "enabled",
|
|
116
|
+
"runtime_switch": "vertex_workload_identity",
|
|
117
|
+
"adapter": "vertex_workload_identity"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": "anthropic_claude_local_subscription",
|
|
121
|
+
"provider": "anthropic",
|
|
122
|
+
"credential_kind": "provider_managed_session",
|
|
123
|
+
"funding_source": "subscription_entitlement",
|
|
124
|
+
"owner_kinds": ["individual"],
|
|
125
|
+
"storage_kinds": ["provider_client_owned"],
|
|
126
|
+
"execution_scopes": ["local"],
|
|
127
|
+
"admission": "enabled",
|
|
128
|
+
"runtime_switch": "anthropic_claude_local_subscription",
|
|
129
|
+
"adapter": "anthropic_claude_local"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "openai_codex_hosted_subscription",
|
|
133
|
+
"provider": "openai",
|
|
134
|
+
"credential_kind": "provider_managed_session",
|
|
135
|
+
"funding_source": "subscription_entitlement",
|
|
136
|
+
"owner_kinds": ["individual"],
|
|
137
|
+
"storage_kinds": ["provider_client_owned"],
|
|
138
|
+
"execution_scopes": ["private_interactive"],
|
|
139
|
+
"admission": "enabled",
|
|
140
|
+
"runtime_switch": "openai_codex_hosted_subscription",
|
|
141
|
+
"adapter": "openai_codex_app_server"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": "xai_grok_hosted_subscription",
|
|
145
|
+
"provider": "xai",
|
|
146
|
+
"credential_kind": "provider_managed_session",
|
|
147
|
+
"funding_source": "subscription_entitlement",
|
|
148
|
+
"owner_kinds": ["individual"],
|
|
149
|
+
"storage_kinds": ["provider_client_owned"],
|
|
150
|
+
"execution_scopes": ["private_interactive"],
|
|
151
|
+
"admission": "enabled",
|
|
152
|
+
"runtime_switch": "xai_grok_hosted_subscription",
|
|
153
|
+
"adapter": "xai_grok_build_acp"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "anthropic_claude_hosted_subscription",
|
|
157
|
+
"provider": "anthropic",
|
|
158
|
+
"credential_kind": "provider_managed_session",
|
|
159
|
+
"funding_source": "subscription_entitlement",
|
|
160
|
+
"owner_kinds": ["individual"],
|
|
161
|
+
"storage_kinds": ["provider_client_owned"],
|
|
162
|
+
"execution_scopes": [],
|
|
163
|
+
"admission": "disabled",
|
|
164
|
+
"runtime_switch": "anthropic_claude_hosted_subscription",
|
|
165
|
+
"adapter": null
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"precedence": [
|
|
4
|
+
"model_auth_revoked",
|
|
5
|
+
"model_auth_capability_disabled",
|
|
6
|
+
"model_auth_missing",
|
|
7
|
+
"model_auth_expired",
|
|
8
|
+
"model_auth_refresh_outcome_indeterminate",
|
|
9
|
+
"model_auth_reauthorization_required",
|
|
10
|
+
"model_auth_account_mismatch",
|
|
11
|
+
"model_auth_refresh_failed",
|
|
12
|
+
"model_auth_entitlement_exhausted",
|
|
13
|
+
"model_auth_scope_ineligible",
|
|
14
|
+
"model_auth_funding_selection_required",
|
|
15
|
+
"model_auth_new_session_required",
|
|
16
|
+
"model_auth_adapter_unavailable",
|
|
17
|
+
"model_auth_misconfigured",
|
|
18
|
+
"model_auth_provider_unavailable"
|
|
19
|
+
],
|
|
20
|
+
"reasons": [
|
|
21
|
+
{"code": "model_auth_missing", "fails_turn": true, "stage": "authorization", "retry_class": "after_reauthorization"},
|
|
22
|
+
{"code": "model_auth_expiring", "fails_turn": false, "stage": "authorization", "retry_class": "never"},
|
|
23
|
+
{"code": "model_auth_expired", "fails_turn": true, "stage": "authorization", "retry_class": "after_reauthorization"},
|
|
24
|
+
{"code": "model_auth_refresh_failed", "fails_turn": true, "stage": "authorization", "retry_class": "provider_later"},
|
|
25
|
+
{"code": "model_auth_reauthorization_required", "fails_turn": true, "stage": "authorization", "retry_class": "after_reauthorization"},
|
|
26
|
+
{"code": "model_auth_refresh_outcome_indeterminate", "fails_turn": true, "stage": "authorization", "retry_class": "after_reauthorization"},
|
|
27
|
+
{"code": "model_auth_entitlement_exhausted", "fails_turn": true, "stage": "authorization", "retry_class": "provider_later"},
|
|
28
|
+
{"code": "model_auth_revoked", "fails_turn": true, "stage": "policy", "retry_class": "after_policy_change"},
|
|
29
|
+
{"code": "model_auth_capability_disabled", "fails_turn": true, "stage": "policy", "retry_class": "after_policy_change"},
|
|
30
|
+
{"code": "model_auth_scope_ineligible", "fails_turn": true, "stage": "policy", "retry_class": "after_policy_change"},
|
|
31
|
+
{"code": "model_auth_funding_selection_required", "fails_turn": true, "stage": "authorization", "retry_class": "never"},
|
|
32
|
+
{"code": "model_auth_new_session_required", "fails_turn": true, "stage": "authorization", "retry_class": "never"},
|
|
33
|
+
{"code": "model_auth_account_mismatch", "fails_turn": true, "stage": "authorization", "retry_class": "after_reauthorization"},
|
|
34
|
+
{"code": "model_auth_adapter_unavailable", "fails_turn": true, "stage": "policy", "retry_class": "after_policy_change"},
|
|
35
|
+
{"code": "model_auth_misconfigured", "fails_turn": true, "stage": "setup", "retry_class": "operator_intervention"},
|
|
36
|
+
{"code": "model_auth_provider_unavailable", "fails_turn": true, "stage": "dispatch", "retry_class": "provider_later"}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dharta/contracts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Dharta wire and executable-Artifact contracts shared across TypeScript and the Python data plane.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./wire-events.json": "./wire-events.json",
|
|
15
|
+
"./artifact-runtime.json": "./artifact-runtime.json",
|
|
16
|
+
"./model-auth-capabilities-v1.json": "./model-auth-capabilities-v1.json",
|
|
17
|
+
"./model-auth-reasons-v1.json": "./model-auth-reasons-v1.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"src",
|
|
22
|
+
"wire-events.json",
|
|
23
|
+
"artifact-runtime.json",
|
|
24
|
+
"model-auth-capabilities-v1.json",
|
|
25
|
+
"model-auth-reasons-v1.json",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"generate:artifact-runtime": "node scripts/generate-artifact-runtime-bindings.mjs",
|
|
30
|
+
"check:artifact-runtime": "node scripts/generate-artifact-runtime-bindings.mjs --check",
|
|
31
|
+
"prepack": "npm run build",
|
|
32
|
+
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"test:watch": "vitest"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.17.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"ajv": "^8.20.0",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vitest": "^4.1.10"
|
|
43
|
+
}
|
|
44
|
+
}
|