@inf-monkeys-tech/monkeys 1.0.21 → 1.0.22
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/lib/contracts/agent.d.ts +471 -0
- package/lib/contracts/agent.d.ts.map +1 -1
- package/lib/contracts/agent.js +211 -4
- package/lib/contracts/agent.js.map +1 -1
- package/lib/contracts/theme.d.ts +1 -1
- package/lib/esm/contracts/index.mjs +207 -8
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +207 -8
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +190 -7
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +194 -7
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/agent-session-command-result.schema.json +105 -0
- package/lib/json-schema/agent-session-command.schema.json +375 -0
- package/lib/json-schema/agent-session-event.schema.json +106 -0
- package/lib/json-schema/agent-session-run-event.schema.json +106 -0
- package/lib/json-schema/agent-session-targeted-command.schema.json +375 -0
- package/lib/json-schema/agent-session-view-model.schema.json +217 -1
- package/lib/schemas/index.d.ts +284 -1
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +7 -3
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
- package/test/fixtures/agent-session-agent.json +5 -1
- package/test/fixtures/agent-session-chatbot.json +5 -1
- package/test/fixtures/agent-session-kernel.json +5 -1
|
@@ -7142,7 +7142,11 @@ var AgentSessionCapabilitySchema = z5.enum([
|
|
|
7142
7142
|
"diff",
|
|
7143
7143
|
"workspaceFiles",
|
|
7144
7144
|
"terminal",
|
|
7145
|
-
"testResults"
|
|
7145
|
+
"testResults",
|
|
7146
|
+
"threadForking",
|
|
7147
|
+
"editAndRerun",
|
|
7148
|
+
"steering",
|
|
7149
|
+
"summary"
|
|
7146
7150
|
]);
|
|
7147
7151
|
var AgentSessionCapabilitiesSchema = z5.object({
|
|
7148
7152
|
text: z5.boolean().default(true),
|
|
@@ -7161,7 +7165,11 @@ var AgentSessionCapabilitiesSchema = z5.object({
|
|
|
7161
7165
|
diff: z5.boolean().default(false),
|
|
7162
7166
|
workspaceFiles: z5.boolean().default(false),
|
|
7163
7167
|
terminal: z5.boolean().default(false),
|
|
7164
|
-
testResults: z5.boolean().default(false)
|
|
7168
|
+
testResults: z5.boolean().default(false),
|
|
7169
|
+
threadForking: z5.boolean().default(false),
|
|
7170
|
+
editAndRerun: z5.boolean().default(false),
|
|
7171
|
+
steering: z5.boolean().default(false),
|
|
7172
|
+
summary: z5.boolean().default(false)
|
|
7165
7173
|
}).strict();
|
|
7166
7174
|
var AGENT_SESSION_RUNTIME_CAPABILITIES = Object.freeze({
|
|
7167
7175
|
chatbot: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, skills: true, approval: true, usage: true }),
|
|
@@ -7184,7 +7192,11 @@ var AGENT_SESSION_CAPABILITY_EVIDENCE = Object.freeze({
|
|
|
7184
7192
|
diff: { eventTypes: ["diff"], commandTypes: [] },
|
|
7185
7193
|
workspaceFiles: { eventTypes: ["workspace-file"], commandTypes: [] },
|
|
7186
7194
|
terminal: { eventTypes: ["terminal"], commandTypes: [] },
|
|
7187
|
-
testResults: { eventTypes: ["test-result"], commandTypes: [] }
|
|
7195
|
+
testResults: { eventTypes: ["test-result"], commandTypes: [] },
|
|
7196
|
+
threadForking: { eventTypes: [], commandTypes: ["fork"] },
|
|
7197
|
+
editAndRerun: { eventTypes: [], commandTypes: ["edit-and-rerun"] },
|
|
7198
|
+
steering: { eventTypes: [], commandTypes: ["steer"] },
|
|
7199
|
+
summary: { eventTypes: ["summary"], commandTypes: [] }
|
|
7188
7200
|
});
|
|
7189
7201
|
var AgentSessionSnapshotSchema = z5.object({
|
|
7190
7202
|
mode: AgentModeSchema,
|
|
@@ -7201,6 +7213,26 @@ var AgentSessionStatusSchema = z5.enum([
|
|
|
7201
7213
|
"failed"
|
|
7202
7214
|
]);
|
|
7203
7215
|
var AgentSessionTerminalStatusSchema = z5.enum(["stopped", "completed", "failed"]);
|
|
7216
|
+
var AgentSessionLineageSchema = z5.object({
|
|
7217
|
+
forkedFromThreadId: ContractIdentifierSchema,
|
|
7218
|
+
forkedFromMessageId: ContractIdentifierSchema,
|
|
7219
|
+
sourceRunId: ContractIdentifierSchema
|
|
7220
|
+
}).strict();
|
|
7221
|
+
var AgentSessionContextInheritanceSchema = z5.object({
|
|
7222
|
+
messages: z5.enum(["through-source-message", "exclude"]),
|
|
7223
|
+
attachments: z5.enum(["inherit", "exclude"]),
|
|
7224
|
+
summaries: z5.enum(["inherit", "exclude"]),
|
|
7225
|
+
toolResults: z5.enum(["inherit", "exclude"]),
|
|
7226
|
+
codeChanges: z5.enum(["inherit", "exclude"])
|
|
7227
|
+
}).strict();
|
|
7228
|
+
var AgentSessionActiveBranchSchema = z5.object({
|
|
7229
|
+
branchId: ContractIdentifierSchema,
|
|
7230
|
+
threadId: ContractIdentifierSchema,
|
|
7231
|
+
sourceMessageId: ContractIdentifierSchema,
|
|
7232
|
+
runId: ContractIdentifierSchema,
|
|
7233
|
+
lineage: AgentSessionLineageSchema.optional(),
|
|
7234
|
+
createdAt: IsoDateTimeSchema
|
|
7235
|
+
}).strict();
|
|
7204
7236
|
var AgentSessionRunSchema = z5.object({
|
|
7205
7237
|
runId: ContractIdentifierSchema,
|
|
7206
7238
|
sessionId: ContractIdentifierSchema,
|
|
@@ -7258,7 +7290,15 @@ var AgentSessionRunSchema = z5.object({
|
|
|
7258
7290
|
});
|
|
7259
7291
|
}
|
|
7260
7292
|
});
|
|
7261
|
-
var AgentSessionCommandTypeSchema = z5.enum([
|
|
7293
|
+
var AgentSessionCommandTypeSchema = z5.enum([
|
|
7294
|
+
"stop",
|
|
7295
|
+
"resume",
|
|
7296
|
+
"retry",
|
|
7297
|
+
"approval",
|
|
7298
|
+
"fork",
|
|
7299
|
+
"edit-and-rerun",
|
|
7300
|
+
"steer"
|
|
7301
|
+
]);
|
|
7262
7302
|
var AgentSessionCommandHeaderSchema = z5.object({
|
|
7263
7303
|
contract: z5.literal("AgentSessionCommand"),
|
|
7264
7304
|
commandId: ContractIdentifierSchema,
|
|
@@ -7286,8 +7326,33 @@ var AgentSessionCommandSchema = z5.discriminatedUnion("commandType", [
|
|
|
7286
7326
|
approvalId: ContractIdentifierSchema,
|
|
7287
7327
|
decision: z5.enum(["approved", "rejected"]),
|
|
7288
7328
|
reason: z5.string().trim().min(1).optional()
|
|
7329
|
+
}),
|
|
7330
|
+
sessionCommand("fork", {
|
|
7331
|
+
sourceThreadId: ContractIdentifierSchema,
|
|
7332
|
+
sourceMessageId: ContractIdentifierSchema,
|
|
7333
|
+
sourceRunId: ContractIdentifierSchema,
|
|
7334
|
+
inheritance: AgentSessionContextInheritanceSchema
|
|
7335
|
+
}),
|
|
7336
|
+
sessionCommand("edit-and-rerun", {
|
|
7337
|
+
sourceThreadId: ContractIdentifierSchema,
|
|
7338
|
+
sourceMessageId: ContractIdentifierSchema,
|
|
7339
|
+
sourceRunId: ContractIdentifierSchema,
|
|
7340
|
+
replacementParts: z5.array(JsonValueSchema).min(1),
|
|
7341
|
+
inheritance: AgentSessionContextInheritanceSchema
|
|
7342
|
+
}),
|
|
7343
|
+
sessionCommand("steer", {
|
|
7344
|
+
targetRunId: ContractIdentifierSchema,
|
|
7345
|
+
guidanceParts: z5.array(JsonValueSchema).min(1)
|
|
7289
7346
|
})
|
|
7290
|
-
])
|
|
7347
|
+
]).superRefine((value, context) => {
|
|
7348
|
+
if (value.commandType === "steer" && value.runId !== value.payload.targetRunId) {
|
|
7349
|
+
context.addIssue({
|
|
7350
|
+
code: "custom",
|
|
7351
|
+
path: ["payload", "targetRunId"],
|
|
7352
|
+
message: "Steering targetRunId must match the command runId."
|
|
7353
|
+
});
|
|
7354
|
+
}
|
|
7355
|
+
});
|
|
7291
7356
|
var AgentSessionTargetedCommandSchema = AgentSessionCommandSchema.and(
|
|
7292
7357
|
z5.object({ runId: ContractIdentifierSchema })
|
|
7293
7358
|
);
|
|
@@ -7304,6 +7369,11 @@ var AgentSessionCommandErrorCodeSchema = z5.enum([
|
|
|
7304
7369
|
"TARGET_EVENT_NOT_RETRYABLE",
|
|
7305
7370
|
"APPROVAL_NOT_FOUND",
|
|
7306
7371
|
"APPROVAL_ALREADY_RESOLVED",
|
|
7372
|
+
"SOURCE_THREAD_NOT_FOUND",
|
|
7373
|
+
"SOURCE_MESSAGE_NOT_FOUND",
|
|
7374
|
+
"SOURCE_RUN_NOT_FOUND",
|
|
7375
|
+
"SOURCE_LINEAGE_INVALID",
|
|
7376
|
+
"ACTIVE_BRANCH_NOT_FOUND",
|
|
7307
7377
|
"COMMAND_EXECUTION_FAILED"
|
|
7308
7378
|
]);
|
|
7309
7379
|
var AgentSessionCommandResultSchema = z5.object({
|
|
@@ -7316,6 +7386,10 @@ var AgentSessionCommandResultSchema = z5.object({
|
|
|
7316
7386
|
sessionStatus: AgentSessionStatusSchema,
|
|
7317
7387
|
acceptedSequence: z5.number().int().nonnegative().optional(),
|
|
7318
7388
|
resultEventIds: z5.array(ContractIdentifierSchema).default([]),
|
|
7389
|
+
operation: z5.object({
|
|
7390
|
+
lineage: AgentSessionLineageSchema,
|
|
7391
|
+
activeBranch: AgentSessionActiveBranchSchema
|
|
7392
|
+
}).strict().optional(),
|
|
7319
7393
|
termination: z5.enum(["requested", "confirmed"]).optional(),
|
|
7320
7394
|
error: z5.object({
|
|
7321
7395
|
code: AgentSessionCommandErrorCodeSchema,
|
|
@@ -7346,6 +7420,97 @@ var AgentSessionCommandResultSchema = z5.object({
|
|
|
7346
7420
|
message: "A confirmed termination requires a terminal run status."
|
|
7347
7421
|
});
|
|
7348
7422
|
}
|
|
7423
|
+
if (value.operation && !value.operation.activeBranch.lineage) {
|
|
7424
|
+
context.addIssue({
|
|
7425
|
+
code: "custom",
|
|
7426
|
+
path: ["operation", "activeBranch", "lineage"],
|
|
7427
|
+
message: "A branch operation result requires lineage on its active branch."
|
|
7428
|
+
});
|
|
7429
|
+
}
|
|
7430
|
+
const operation = value.operation;
|
|
7431
|
+
if (operation?.activeBranch.lineage) {
|
|
7432
|
+
const { lineage } = operation;
|
|
7433
|
+
const branchLineage = operation.activeBranch.lineage;
|
|
7434
|
+
if (lineage.forkedFromThreadId !== branchLineage.forkedFromThreadId || lineage.forkedFromMessageId !== branchLineage.forkedFromMessageId || lineage.sourceRunId !== branchLineage.sourceRunId) {
|
|
7435
|
+
context.addIssue({
|
|
7436
|
+
code: "custom",
|
|
7437
|
+
path: ["operation", "activeBranch", "lineage"],
|
|
7438
|
+
message: "Active branch lineage must match the operation lineage."
|
|
7439
|
+
});
|
|
7440
|
+
}
|
|
7441
|
+
}
|
|
7442
|
+
if (value.operation && value.runId !== value.operation.activeBranch.runId) {
|
|
7443
|
+
context.addIssue({
|
|
7444
|
+
code: "custom",
|
|
7445
|
+
path: ["operation", "activeBranch", "runId"],
|
|
7446
|
+
message: "Active branch runId must match the command result runId."
|
|
7447
|
+
});
|
|
7448
|
+
}
|
|
7449
|
+
});
|
|
7450
|
+
var AgentSessionCommandPolicySchema = z5.object({
|
|
7451
|
+
capability: AgentSessionCapabilitySchema.optional(),
|
|
7452
|
+
allowedStatuses: z5.array(AgentSessionStatusSchema).min(1),
|
|
7453
|
+
requiresRunId: z5.boolean(),
|
|
7454
|
+
sourceSessionEffect: z5.enum(["transition", "preserve"]),
|
|
7455
|
+
idempotencyScope: z5.literal("session-command"),
|
|
7456
|
+
sequenceRule: z5.literal("match-current")
|
|
7457
|
+
}).strict();
|
|
7458
|
+
var sessionCommandPolicy = (policy) => AgentSessionCommandPolicySchema.parse(policy);
|
|
7459
|
+
var AGENT_SESSION_COMMAND_POLICIES = Object.freeze({
|
|
7460
|
+
stop: sessionCommandPolicy({
|
|
7461
|
+
allowedStatuses: ["queued", "running", "waiting_approval"],
|
|
7462
|
+
requiresRunId: true,
|
|
7463
|
+
sourceSessionEffect: "transition",
|
|
7464
|
+
idempotencyScope: "session-command",
|
|
7465
|
+
sequenceRule: "match-current"
|
|
7466
|
+
}),
|
|
7467
|
+
resume: sessionCommandPolicy({
|
|
7468
|
+
capability: "resume",
|
|
7469
|
+
allowedStatuses: ["stopped", "completed", "failed"],
|
|
7470
|
+
requiresRunId: true,
|
|
7471
|
+
sourceSessionEffect: "transition",
|
|
7472
|
+
idempotencyScope: "session-command",
|
|
7473
|
+
sequenceRule: "match-current"
|
|
7474
|
+
}),
|
|
7475
|
+
retry: sessionCommandPolicy({
|
|
7476
|
+
allowedStatuses: ["failed"],
|
|
7477
|
+
requiresRunId: true,
|
|
7478
|
+
sourceSessionEffect: "transition",
|
|
7479
|
+
idempotencyScope: "session-command",
|
|
7480
|
+
sequenceRule: "match-current"
|
|
7481
|
+
}),
|
|
7482
|
+
approval: sessionCommandPolicy({
|
|
7483
|
+
capability: "approval",
|
|
7484
|
+
allowedStatuses: ["waiting_approval"],
|
|
7485
|
+
requiresRunId: true,
|
|
7486
|
+
sourceSessionEffect: "transition",
|
|
7487
|
+
idempotencyScope: "session-command",
|
|
7488
|
+
sequenceRule: "match-current"
|
|
7489
|
+
}),
|
|
7490
|
+
fork: sessionCommandPolicy({
|
|
7491
|
+
capability: "threadForking",
|
|
7492
|
+
allowedStatuses: AgentSessionStatusSchema.options,
|
|
7493
|
+
requiresRunId: false,
|
|
7494
|
+
sourceSessionEffect: "preserve",
|
|
7495
|
+
idempotencyScope: "session-command",
|
|
7496
|
+
sequenceRule: "match-current"
|
|
7497
|
+
}),
|
|
7498
|
+
"edit-and-rerun": sessionCommandPolicy({
|
|
7499
|
+
capability: "editAndRerun",
|
|
7500
|
+
allowedStatuses: ["stopped", "completed", "failed"],
|
|
7501
|
+
requiresRunId: false,
|
|
7502
|
+
sourceSessionEffect: "preserve",
|
|
7503
|
+
idempotencyScope: "session-command",
|
|
7504
|
+
sequenceRule: "match-current"
|
|
7505
|
+
}),
|
|
7506
|
+
steer: sessionCommandPolicy({
|
|
7507
|
+
capability: "steering",
|
|
7508
|
+
allowedStatuses: ["queued", "running"],
|
|
7509
|
+
requiresRunId: true,
|
|
7510
|
+
sourceSessionEffect: "preserve",
|
|
7511
|
+
idempotencyScope: "session-command",
|
|
7512
|
+
sequenceRule: "match-current"
|
|
7513
|
+
})
|
|
7349
7514
|
});
|
|
7350
7515
|
function isAgentSessionTerminalStatus(status) {
|
|
7351
7516
|
return AgentSessionTerminalStatusSchema.safeParse(status).success;
|
|
@@ -7475,8 +7640,24 @@ var AgentSessionEventSchema = z5.discriminatedUnion("eventType", [
|
|
|
7475
7640
|
status: z5.enum(["running", "passed", "failed", "skipped"]),
|
|
7476
7641
|
durationMs: z5.number().nonnegative().optional(),
|
|
7477
7642
|
output: z5.string().optional()
|
|
7643
|
+
}),
|
|
7644
|
+
sessionEvent("summary", {
|
|
7645
|
+
summaryId: ContractIdentifierSchema,
|
|
7646
|
+
runId: ContractIdentifierSchema,
|
|
7647
|
+
text: z5.string(),
|
|
7648
|
+
highlights: z5.array(z5.string()),
|
|
7649
|
+
pendingItems: z5.array(z5.string()),
|
|
7650
|
+
status: z5.enum(["generating", "completed", "failed"])
|
|
7478
7651
|
})
|
|
7479
|
-
])
|
|
7652
|
+
]).superRefine((value, context) => {
|
|
7653
|
+
if (value.eventType === "summary" && value.runId !== value.payload.runId) {
|
|
7654
|
+
context.addIssue({
|
|
7655
|
+
code: "custom",
|
|
7656
|
+
path: ["payload", "runId"],
|
|
7657
|
+
message: "Summary payload runId must match the event runId."
|
|
7658
|
+
});
|
|
7659
|
+
}
|
|
7660
|
+
});
|
|
7480
7661
|
var AgentSessionRunEventSchema = AgentSessionEventSchema.superRefine((value, context) => {
|
|
7481
7662
|
if (!value.runId) {
|
|
7482
7663
|
context.addIssue({ code: "custom", path: ["runId"], message: "Run events require runId." });
|
|
@@ -7512,7 +7693,9 @@ var AgentSessionViewModelSchema = z5.object({
|
|
|
7512
7693
|
status: AgentSessionStatusSchema,
|
|
7513
7694
|
events: z5.array(AgentSessionEventSchema),
|
|
7514
7695
|
lastSequence: z5.number().int().min(-1),
|
|
7515
|
-
resumable: z5.boolean().default(false)
|
|
7696
|
+
resumable: z5.boolean().default(false),
|
|
7697
|
+
lineage: AgentSessionLineageSchema.optional(),
|
|
7698
|
+
activeBranch: AgentSessionActiveBranchSchema.optional()
|
|
7516
7699
|
}).strict().superRefine((value, context) => {
|
|
7517
7700
|
const eventIds = /* @__PURE__ */ new Set();
|
|
7518
7701
|
const idempotencyKeys = /* @__PURE__ */ new Set();
|
|
@@ -11814,13 +11997,17 @@ export {
|
|
|
11814
11997
|
AgentModeSchema,
|
|
11815
11998
|
AgentResourceModeSupportSchema,
|
|
11816
11999
|
AgentRuntimeEventSchema,
|
|
12000
|
+
AgentSessionActiveBranchSchema,
|
|
11817
12001
|
AgentSessionCapabilitiesSchema,
|
|
11818
12002
|
AgentSessionCapabilitySchema,
|
|
11819
12003
|
AgentSessionCommandErrorCodeSchema,
|
|
12004
|
+
AgentSessionCommandPolicySchema,
|
|
11820
12005
|
AgentSessionCommandResultSchema,
|
|
11821
12006
|
AgentSessionCommandSchema,
|
|
11822
12007
|
AgentSessionCommandTypeSchema,
|
|
12008
|
+
AgentSessionContextInheritanceSchema,
|
|
11823
12009
|
AgentSessionEventSchema,
|
|
12010
|
+
AgentSessionLineageSchema,
|
|
11824
12011
|
AgentSessionRunEventSchema,
|
|
11825
12012
|
AgentSessionRunSchema,
|
|
11826
12013
|
AgentSessionSnapshotSchema,
|