@hosty-sdk/app 0.50.0 → 0.51.0
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/agent-schemas.js +7 -4
- package/dist/agent-server.js +11 -5
- package/dist/agent.d.ts +5 -0
- package/package.json +1 -1
- package/schemas/agent-event-v1.schema.json +57 -34
- package/schemas/agent-v1.openapi.json +57 -34
package/dist/agent-schemas.js
CHANGED
|
@@ -57,6 +57,8 @@ export const AGENT_SCHEMAS = {
|
|
|
57
57
|
object({ ...baseControl, command: { const: "predictions" }, enabled: boolean }),
|
|
58
58
|
] },
|
|
59
59
|
Source: object({ agentId: id, parentAgentId: id, parentToolCallId: id }, ["agentId"]),
|
|
60
|
+
ChildAgent: object({ agentId: id, parentAgentId: id, parentToolCallId: id, state: { enum: terminalStates }, stopConfirmed: boolean,
|
|
61
|
+
prompt: { type: "string", maxLength: 65536 }, response: { type: "string", maxLength: 65536 }, promptTruncated: boolean, responseTruncated: boolean }, ["agentId", "state"], true),
|
|
60
62
|
PendingDecision: object({ id, revision, kind: { enum: ["approval", "question"] }, delivery: { enum: ["continue_run", "next_turn"] }, source: ref("Source"), title: text(65536), toolCallId: id, toolName: text(), input: {},
|
|
61
63
|
questions: list(object({ id, text: text(65536), header: text(1024), allowText: boolean, multiple: boolean, required: boolean,
|
|
62
64
|
options: list(object({ id, label: text(8192), description: text(8192), preview: text(65536) }, ["id", "label"]), 128) }, ["id", "text"]), 128) }, ["id", "revision", "kind", "delivery"], true),
|
|
@@ -68,7 +70,7 @@ export const AGENT_SCHEMAS = {
|
|
|
68
70
|
state: { enum: terminalStates }, phase: { enum: phases }, stopConfirmed: boolean, freshness: { enum: ["current", "last_known", "unavailable"] }, observedAt: { type: "string", format: "date-time" },
|
|
69
71
|
configurationRevision: revision, lastSequence: sequence, cursor: text(8192), pending: list(ref("PendingDecision"), 256),
|
|
70
72
|
effects: object({ certainty: { enum: ["known", "unknown"] }, unresolvedCallIds: unique(id, 1024) }), result: ref("Result"), messages: list(ref("Message"), 4096), tools: list(ref("Tool"), 4096),
|
|
71
|
-
agents: list(
|
|
73
|
+
agents: list(ref("ChildAgent"), 1024),
|
|
72
74
|
selection: object({ requested: ref("Selection"), effective: ref("Selection") }), admissionRef: text(),
|
|
73
75
|
coverage: object({ messages: { enum: ["complete", "truncated"] }, tools: { enum: ["complete", "truncated"] }, decisions: { enum: ["complete", "truncated"] } }, ["messages", "tools"]),
|
|
74
76
|
executionUsage: object({ sequence, activeMs: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER }, unknown: boolean }),
|
|
@@ -107,9 +109,10 @@ AGENT_SCHEMAS.Event = { ...object({ schemaVersion: { const: "agent-event.1" }, r
|
|
|
107
109
|
: name.startsWith("decision.") ? object({ decisionId: id, decision: ref("PendingDecision") }, ["decisionId"], true)
|
|
108
110
|
: name === "control.updated" ? object({ requestId: uuid, receipt: ref("ControlReceipt") }, ["requestId"], true)
|
|
109
111
|
: name === "session.bound" ? object({ sessionId: id }, ["sessionId"], true)
|
|
110
|
-
: name === "
|
|
111
|
-
: name === "
|
|
112
|
-
: {
|
|
112
|
+
: name === "agent.updated" ? object({ agent: ref("ChildAgent") }, [], true)
|
|
113
|
+
: name === "context.updated" ? object({ usage: { type: ["object", "null"], additionalProperties: true } }, ["usage"], true)
|
|
114
|
+
: name === "extension" ? object({ namespace: text(), required: { const: false }, payload: {} }, ["namespace"], true)
|
|
115
|
+
: { type: "object", additionalProperties: true } } } })),
|
|
113
116
|
};
|
|
114
117
|
const page = (key, item) => object({ [key]: list(ref(item), 100), nextCursor: { type: ["string", "null"], maxLength: 8192 } });
|
|
115
118
|
AGENT_SCHEMAS.SessionPage = page("sessions", "Session");
|
package/dist/agent-server.js
CHANGED
|
@@ -420,6 +420,13 @@ function finiteJson(value, depth = 0, seen = new Set()) {
|
|
|
420
420
|
function contextUsage(value) { return value === null || object(value) && finiteJson(value); }
|
|
421
421
|
function source(value) { if (!object(value) || !opaque(value.agentId) || value.parentAgentId !== undefined && !opaque(value.parentAgentId) || value.parentToolCallId !== undefined && (!opaque(value.parentToolCallId) || !opaque(value.parentAgentId)))
|
|
422
422
|
responseProblem("Invalid execution source."); }
|
|
423
|
+
function validateChildAgent(agent) {
|
|
424
|
+
source(agent);
|
|
425
|
+
if (!object(agent) || !["queued", "running", "waiting_for_input", "succeeded", "failed", "cancelled", "unknown"].includes(String(agent.state))
|
|
426
|
+
|| [agent.stopConfirmed, agent.promptTruncated, agent.responseTruncated].some(flag => flag !== undefined && typeof flag !== "boolean")
|
|
427
|
+
|| [agent.prompt, agent.response].some(text => text !== undefined && (typeof text !== "string" || text.length > 65536 && [...text].length > 65536)))
|
|
428
|
+
responseProblem("Invalid child agent observation.");
|
|
429
|
+
}
|
|
423
430
|
export function validateAgentPendingDecision(value) {
|
|
424
431
|
if (!object(value) || !opaque(value.id) || !decimal(value.revision) || !["approval", "question"].includes(String(value.kind)) || !["continue_run", "next_turn"].includes(String(value.delivery)))
|
|
425
432
|
responseProblem("Invalid pending decision.");
|
|
@@ -509,11 +516,8 @@ export function validateAgentRunSnapshot(value) {
|
|
|
509
516
|
}
|
|
510
517
|
if (value.agents !== undefined) {
|
|
511
518
|
array(value.agents, 1024, "agent inventory");
|
|
512
|
-
for (const agent of value.agents)
|
|
513
|
-
|
|
514
|
-
if (!object(agent) || !["queued", "running", "waiting_for_input", "succeeded", "failed", "cancelled", "unknown"].includes(String(agent.state)) || agent.stopConfirmed !== undefined && typeof agent.stopConfirmed !== "boolean")
|
|
515
|
-
responseProblem("Invalid retained child agent state.");
|
|
516
|
-
}
|
|
519
|
+
for (const agent of value.agents)
|
|
520
|
+
validateChildAgent(agent);
|
|
517
521
|
}
|
|
518
522
|
if (Buffer.byteLength(JSON.stringify(value)) > AGENT_COMMAND_MAX_BYTES)
|
|
519
523
|
responseProblem("Snapshot byte allowance exceeded.");
|
|
@@ -544,6 +548,8 @@ export function validateAgentEvent(value) {
|
|
|
544
548
|
responseProblem("Context events require nullable JSON observation data.");
|
|
545
549
|
else if (value.type === "extension" && (!bounded(data.namespace, 256) || data.required === true))
|
|
546
550
|
responseProblem("Extensions cannot carry required protocol semantics.");
|
|
551
|
+
if (value.type === "agent.updated" && data.agent !== undefined)
|
|
552
|
+
validateChildAgent(data.agent);
|
|
547
553
|
if (data.decision !== undefined)
|
|
548
554
|
validateAgentPendingDecision(data.decision);
|
|
549
555
|
if (data.response !== undefined) {
|
package/dist/agent.d.ts
CHANGED
|
@@ -322,6 +322,11 @@ export type AgentRunSnapshot = {
|
|
|
322
322
|
agents?: Array<AgentSource & {
|
|
323
323
|
state: AgentRunState;
|
|
324
324
|
stopConfirmed?: boolean;
|
|
325
|
+
/** Native assignment and final answer, when the provider can attribute them to this child. */
|
|
326
|
+
prompt?: string;
|
|
327
|
+
response?: string;
|
|
328
|
+
promptTruncated?: boolean;
|
|
329
|
+
responseTruncated?: boolean;
|
|
325
330
|
}>;
|
|
326
331
|
selection?: {
|
|
327
332
|
requested: {
|
package/package.json
CHANGED
|
@@ -1124,6 +1124,56 @@
|
|
|
1124
1124
|
],
|
|
1125
1125
|
"additionalProperties": false
|
|
1126
1126
|
},
|
|
1127
|
+
"ChildAgent": {
|
|
1128
|
+
"type": "object",
|
|
1129
|
+
"properties": {
|
|
1130
|
+
"agentId": {
|
|
1131
|
+
"type": "string",
|
|
1132
|
+
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
1133
|
+
},
|
|
1134
|
+
"parentAgentId": {
|
|
1135
|
+
"type": "string",
|
|
1136
|
+
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
1137
|
+
},
|
|
1138
|
+
"parentToolCallId": {
|
|
1139
|
+
"type": "string",
|
|
1140
|
+
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
1141
|
+
},
|
|
1142
|
+
"state": {
|
|
1143
|
+
"enum": [
|
|
1144
|
+
"queued",
|
|
1145
|
+
"running",
|
|
1146
|
+
"waiting_for_input",
|
|
1147
|
+
"succeeded",
|
|
1148
|
+
"failed",
|
|
1149
|
+
"cancelled",
|
|
1150
|
+
"unknown"
|
|
1151
|
+
]
|
|
1152
|
+
},
|
|
1153
|
+
"stopConfirmed": {
|
|
1154
|
+
"type": "boolean"
|
|
1155
|
+
},
|
|
1156
|
+
"prompt": {
|
|
1157
|
+
"type": "string",
|
|
1158
|
+
"maxLength": 65536
|
|
1159
|
+
},
|
|
1160
|
+
"response": {
|
|
1161
|
+
"type": "string",
|
|
1162
|
+
"maxLength": 65536
|
|
1163
|
+
},
|
|
1164
|
+
"promptTruncated": {
|
|
1165
|
+
"type": "boolean"
|
|
1166
|
+
},
|
|
1167
|
+
"responseTruncated": {
|
|
1168
|
+
"type": "boolean"
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
"required": [
|
|
1172
|
+
"agentId",
|
|
1173
|
+
"state"
|
|
1174
|
+
],
|
|
1175
|
+
"additionalProperties": true
|
|
1176
|
+
},
|
|
1127
1177
|
"PendingDecision": {
|
|
1128
1178
|
"type": "object",
|
|
1129
1179
|
"properties": {
|
|
@@ -1502,40 +1552,7 @@
|
|
|
1502
1552
|
"type": "array",
|
|
1503
1553
|
"maxItems": 1024,
|
|
1504
1554
|
"items": {
|
|
1505
|
-
"
|
|
1506
|
-
"properties": {
|
|
1507
|
-
"agentId": {
|
|
1508
|
-
"type": "string",
|
|
1509
|
-
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
1510
|
-
},
|
|
1511
|
-
"parentAgentId": {
|
|
1512
|
-
"type": "string",
|
|
1513
|
-
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
1514
|
-
},
|
|
1515
|
-
"parentToolCallId": {
|
|
1516
|
-
"type": "string",
|
|
1517
|
-
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
1518
|
-
},
|
|
1519
|
-
"state": {
|
|
1520
|
-
"enum": [
|
|
1521
|
-
"queued",
|
|
1522
|
-
"running",
|
|
1523
|
-
"waiting_for_input",
|
|
1524
|
-
"succeeded",
|
|
1525
|
-
"failed",
|
|
1526
|
-
"cancelled",
|
|
1527
|
-
"unknown"
|
|
1528
|
-
]
|
|
1529
|
-
},
|
|
1530
|
-
"stopConfirmed": {
|
|
1531
|
-
"type": "boolean"
|
|
1532
|
-
}
|
|
1533
|
-
},
|
|
1534
|
-
"required": [
|
|
1535
|
-
"agentId",
|
|
1536
|
-
"state"
|
|
1537
|
-
],
|
|
1538
|
-
"additionalProperties": true
|
|
1555
|
+
"$ref": "#/$defs/ChildAgent"
|
|
1539
1556
|
}
|
|
1540
1557
|
},
|
|
1541
1558
|
"selection": {
|
|
@@ -3155,6 +3172,12 @@
|
|
|
3155
3172
|
"properties": {
|
|
3156
3173
|
"data": {
|
|
3157
3174
|
"type": "object",
|
|
3175
|
+
"properties": {
|
|
3176
|
+
"agent": {
|
|
3177
|
+
"$ref": "#/$defs/ChildAgent"
|
|
3178
|
+
}
|
|
3179
|
+
},
|
|
3180
|
+
"required": [],
|
|
3158
3181
|
"additionalProperties": true
|
|
3159
3182
|
}
|
|
3160
3183
|
}
|
|
@@ -4233,6 +4233,56 @@
|
|
|
4233
4233
|
],
|
|
4234
4234
|
"additionalProperties": false
|
|
4235
4235
|
},
|
|
4236
|
+
"ChildAgent": {
|
|
4237
|
+
"type": "object",
|
|
4238
|
+
"properties": {
|
|
4239
|
+
"agentId": {
|
|
4240
|
+
"type": "string",
|
|
4241
|
+
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
4242
|
+
},
|
|
4243
|
+
"parentAgentId": {
|
|
4244
|
+
"type": "string",
|
|
4245
|
+
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
4246
|
+
},
|
|
4247
|
+
"parentToolCallId": {
|
|
4248
|
+
"type": "string",
|
|
4249
|
+
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
4250
|
+
},
|
|
4251
|
+
"state": {
|
|
4252
|
+
"enum": [
|
|
4253
|
+
"queued",
|
|
4254
|
+
"running",
|
|
4255
|
+
"waiting_for_input",
|
|
4256
|
+
"succeeded",
|
|
4257
|
+
"failed",
|
|
4258
|
+
"cancelled",
|
|
4259
|
+
"unknown"
|
|
4260
|
+
]
|
|
4261
|
+
},
|
|
4262
|
+
"stopConfirmed": {
|
|
4263
|
+
"type": "boolean"
|
|
4264
|
+
},
|
|
4265
|
+
"prompt": {
|
|
4266
|
+
"type": "string",
|
|
4267
|
+
"maxLength": 65536
|
|
4268
|
+
},
|
|
4269
|
+
"response": {
|
|
4270
|
+
"type": "string",
|
|
4271
|
+
"maxLength": 65536
|
|
4272
|
+
},
|
|
4273
|
+
"promptTruncated": {
|
|
4274
|
+
"type": "boolean"
|
|
4275
|
+
},
|
|
4276
|
+
"responseTruncated": {
|
|
4277
|
+
"type": "boolean"
|
|
4278
|
+
}
|
|
4279
|
+
},
|
|
4280
|
+
"required": [
|
|
4281
|
+
"agentId",
|
|
4282
|
+
"state"
|
|
4283
|
+
],
|
|
4284
|
+
"additionalProperties": true
|
|
4285
|
+
},
|
|
4236
4286
|
"PendingDecision": {
|
|
4237
4287
|
"type": "object",
|
|
4238
4288
|
"properties": {
|
|
@@ -4611,40 +4661,7 @@
|
|
|
4611
4661
|
"type": "array",
|
|
4612
4662
|
"maxItems": 1024,
|
|
4613
4663
|
"items": {
|
|
4614
|
-
"
|
|
4615
|
-
"properties": {
|
|
4616
|
-
"agentId": {
|
|
4617
|
-
"type": "string",
|
|
4618
|
-
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
4619
|
-
},
|
|
4620
|
-
"parentAgentId": {
|
|
4621
|
-
"type": "string",
|
|
4622
|
-
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
4623
|
-
},
|
|
4624
|
-
"parentToolCallId": {
|
|
4625
|
-
"type": "string",
|
|
4626
|
-
"pattern": "^[A-Za-z0-9_-]{1,256}$"
|
|
4627
|
-
},
|
|
4628
|
-
"state": {
|
|
4629
|
-
"enum": [
|
|
4630
|
-
"queued",
|
|
4631
|
-
"running",
|
|
4632
|
-
"waiting_for_input",
|
|
4633
|
-
"succeeded",
|
|
4634
|
-
"failed",
|
|
4635
|
-
"cancelled",
|
|
4636
|
-
"unknown"
|
|
4637
|
-
]
|
|
4638
|
-
},
|
|
4639
|
-
"stopConfirmed": {
|
|
4640
|
-
"type": "boolean"
|
|
4641
|
-
}
|
|
4642
|
-
},
|
|
4643
|
-
"required": [
|
|
4644
|
-
"agentId",
|
|
4645
|
-
"state"
|
|
4646
|
-
],
|
|
4647
|
-
"additionalProperties": true
|
|
4664
|
+
"$ref": "#/components/schemas/ChildAgent"
|
|
4648
4665
|
}
|
|
4649
4666
|
},
|
|
4650
4667
|
"selection": {
|
|
@@ -6264,6 +6281,12 @@
|
|
|
6264
6281
|
"properties": {
|
|
6265
6282
|
"data": {
|
|
6266
6283
|
"type": "object",
|
|
6284
|
+
"properties": {
|
|
6285
|
+
"agent": {
|
|
6286
|
+
"$ref": "#/components/schemas/ChildAgent"
|
|
6287
|
+
}
|
|
6288
|
+
},
|
|
6289
|
+
"required": [],
|
|
6267
6290
|
"additionalProperties": true
|
|
6268
6291
|
}
|
|
6269
6292
|
}
|