@inf-monkeys-tech/monkeys 1.0.21 → 1.0.23
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 +213 -6
- package/lib/contracts/agent.js.map +1 -1
- package/lib/contracts/theme.d.ts +1 -1
- package/lib/esm/contracts/index.mjs +209 -10
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +209 -10
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +192 -9
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +196 -9
- 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 +25 -2
- package/test/fixtures/agent-session-kernel.json +5 -1
|
@@ -7646,7 +7646,11 @@ var AgentSessionCapabilitySchema = z5.enum([
|
|
|
7646
7646
|
"diff",
|
|
7647
7647
|
"workspaceFiles",
|
|
7648
7648
|
"terminal",
|
|
7649
|
-
"testResults"
|
|
7649
|
+
"testResults",
|
|
7650
|
+
"threadForking",
|
|
7651
|
+
"editAndRerun",
|
|
7652
|
+
"steering",
|
|
7653
|
+
"summary"
|
|
7650
7654
|
]);
|
|
7651
7655
|
var AgentSessionCapabilitiesSchema = z5.object({
|
|
7652
7656
|
text: z5.boolean().default(true),
|
|
@@ -7665,11 +7669,15 @@ var AgentSessionCapabilitiesSchema = z5.object({
|
|
|
7665
7669
|
diff: z5.boolean().default(false),
|
|
7666
7670
|
workspaceFiles: z5.boolean().default(false),
|
|
7667
7671
|
terminal: z5.boolean().default(false),
|
|
7668
|
-
testResults: z5.boolean().default(false)
|
|
7672
|
+
testResults: z5.boolean().default(false),
|
|
7673
|
+
threadForking: z5.boolean().default(false),
|
|
7674
|
+
editAndRerun: z5.boolean().default(false),
|
|
7675
|
+
steering: z5.boolean().default(false),
|
|
7676
|
+
summary: z5.boolean().default(false)
|
|
7669
7677
|
}).strict();
|
|
7670
7678
|
var AGENT_SESSION_RUNTIME_CAPABILITIES = Object.freeze({
|
|
7671
|
-
chatbot: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, skills: true, approval: true, usage: true }),
|
|
7672
|
-
agent: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, shell: true, fileChange: true, skills: true, approval: true, artifacts: true, usage: true, resume: true })
|
|
7679
|
+
chatbot: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, skills: true, approval: true, usage: true, summary: true }),
|
|
7680
|
+
agent: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, shell: true, fileChange: true, skills: true, approval: true, artifacts: true, usage: true, resume: true, summary: true })
|
|
7673
7681
|
});
|
|
7674
7682
|
var AGENT_SESSION_CAPABILITY_EVIDENCE = Object.freeze({
|
|
7675
7683
|
text: { eventTypes: ["message"], commandTypes: [] },
|
|
@@ -7688,7 +7696,11 @@ var AGENT_SESSION_CAPABILITY_EVIDENCE = Object.freeze({
|
|
|
7688
7696
|
diff: { eventTypes: ["diff"], commandTypes: [] },
|
|
7689
7697
|
workspaceFiles: { eventTypes: ["workspace-file"], commandTypes: [] },
|
|
7690
7698
|
terminal: { eventTypes: ["terminal"], commandTypes: [] },
|
|
7691
|
-
testResults: { eventTypes: ["test-result"], commandTypes: [] }
|
|
7699
|
+
testResults: { eventTypes: ["test-result"], commandTypes: [] },
|
|
7700
|
+
threadForking: { eventTypes: [], commandTypes: ["fork"] },
|
|
7701
|
+
editAndRerun: { eventTypes: [], commandTypes: ["edit-and-rerun"] },
|
|
7702
|
+
steering: { eventTypes: [], commandTypes: ["steer"] },
|
|
7703
|
+
summary: { eventTypes: ["summary"], commandTypes: [] }
|
|
7692
7704
|
});
|
|
7693
7705
|
var AgentSessionSnapshotSchema = z5.object({
|
|
7694
7706
|
mode: AgentModeSchema,
|
|
@@ -7705,6 +7717,26 @@ var AgentSessionStatusSchema = z5.enum([
|
|
|
7705
7717
|
"failed"
|
|
7706
7718
|
]);
|
|
7707
7719
|
var AgentSessionTerminalStatusSchema = z5.enum(["stopped", "completed", "failed"]);
|
|
7720
|
+
var AgentSessionLineageSchema = z5.object({
|
|
7721
|
+
forkedFromThreadId: ContractIdentifierSchema,
|
|
7722
|
+
forkedFromMessageId: ContractIdentifierSchema,
|
|
7723
|
+
sourceRunId: ContractIdentifierSchema
|
|
7724
|
+
}).strict();
|
|
7725
|
+
var AgentSessionContextInheritanceSchema = z5.object({
|
|
7726
|
+
messages: z5.enum(["through-source-message", "exclude"]),
|
|
7727
|
+
attachments: z5.enum(["inherit", "exclude"]),
|
|
7728
|
+
summaries: z5.enum(["inherit", "exclude"]),
|
|
7729
|
+
toolResults: z5.enum(["inherit", "exclude"]),
|
|
7730
|
+
codeChanges: z5.enum(["inherit", "exclude"])
|
|
7731
|
+
}).strict();
|
|
7732
|
+
var AgentSessionActiveBranchSchema = z5.object({
|
|
7733
|
+
branchId: ContractIdentifierSchema,
|
|
7734
|
+
threadId: ContractIdentifierSchema,
|
|
7735
|
+
sourceMessageId: ContractIdentifierSchema,
|
|
7736
|
+
runId: ContractIdentifierSchema,
|
|
7737
|
+
lineage: AgentSessionLineageSchema.optional(),
|
|
7738
|
+
createdAt: IsoDateTimeSchema
|
|
7739
|
+
}).strict();
|
|
7708
7740
|
var AgentSessionRunSchema = z5.object({
|
|
7709
7741
|
runId: ContractIdentifierSchema,
|
|
7710
7742
|
sessionId: ContractIdentifierSchema,
|
|
@@ -7762,7 +7794,15 @@ var AgentSessionRunSchema = z5.object({
|
|
|
7762
7794
|
});
|
|
7763
7795
|
}
|
|
7764
7796
|
});
|
|
7765
|
-
var AgentSessionCommandTypeSchema = z5.enum([
|
|
7797
|
+
var AgentSessionCommandTypeSchema = z5.enum([
|
|
7798
|
+
"stop",
|
|
7799
|
+
"resume",
|
|
7800
|
+
"retry",
|
|
7801
|
+
"approval",
|
|
7802
|
+
"fork",
|
|
7803
|
+
"edit-and-rerun",
|
|
7804
|
+
"steer"
|
|
7805
|
+
]);
|
|
7766
7806
|
var AgentSessionCommandHeaderSchema = z5.object({
|
|
7767
7807
|
contract: z5.literal("AgentSessionCommand"),
|
|
7768
7808
|
commandId: ContractIdentifierSchema,
|
|
@@ -7790,8 +7830,33 @@ var AgentSessionCommandSchema = z5.discriminatedUnion("commandType", [
|
|
|
7790
7830
|
approvalId: ContractIdentifierSchema,
|
|
7791
7831
|
decision: z5.enum(["approved", "rejected"]),
|
|
7792
7832
|
reason: z5.string().trim().min(1).optional()
|
|
7833
|
+
}),
|
|
7834
|
+
sessionCommand("fork", {
|
|
7835
|
+
sourceThreadId: ContractIdentifierSchema,
|
|
7836
|
+
sourceMessageId: ContractIdentifierSchema,
|
|
7837
|
+
sourceRunId: ContractIdentifierSchema,
|
|
7838
|
+
inheritance: AgentSessionContextInheritanceSchema
|
|
7839
|
+
}),
|
|
7840
|
+
sessionCommand("edit-and-rerun", {
|
|
7841
|
+
sourceThreadId: ContractIdentifierSchema,
|
|
7842
|
+
sourceMessageId: ContractIdentifierSchema,
|
|
7843
|
+
sourceRunId: ContractIdentifierSchema,
|
|
7844
|
+
replacementParts: z5.array(JsonValueSchema).min(1),
|
|
7845
|
+
inheritance: AgentSessionContextInheritanceSchema
|
|
7846
|
+
}),
|
|
7847
|
+
sessionCommand("steer", {
|
|
7848
|
+
targetRunId: ContractIdentifierSchema,
|
|
7849
|
+
guidanceParts: z5.array(JsonValueSchema).min(1)
|
|
7793
7850
|
})
|
|
7794
|
-
])
|
|
7851
|
+
]).superRefine((value, context) => {
|
|
7852
|
+
if (value.commandType === "steer" && value.runId !== value.payload.targetRunId) {
|
|
7853
|
+
context.addIssue({
|
|
7854
|
+
code: "custom",
|
|
7855
|
+
path: ["payload", "targetRunId"],
|
|
7856
|
+
message: "Steering targetRunId must match the command runId."
|
|
7857
|
+
});
|
|
7858
|
+
}
|
|
7859
|
+
});
|
|
7795
7860
|
var AgentSessionTargetedCommandSchema = AgentSessionCommandSchema.and(
|
|
7796
7861
|
z5.object({ runId: ContractIdentifierSchema })
|
|
7797
7862
|
);
|
|
@@ -7808,6 +7873,11 @@ var AgentSessionCommandErrorCodeSchema = z5.enum([
|
|
|
7808
7873
|
"TARGET_EVENT_NOT_RETRYABLE",
|
|
7809
7874
|
"APPROVAL_NOT_FOUND",
|
|
7810
7875
|
"APPROVAL_ALREADY_RESOLVED",
|
|
7876
|
+
"SOURCE_THREAD_NOT_FOUND",
|
|
7877
|
+
"SOURCE_MESSAGE_NOT_FOUND",
|
|
7878
|
+
"SOURCE_RUN_NOT_FOUND",
|
|
7879
|
+
"SOURCE_LINEAGE_INVALID",
|
|
7880
|
+
"ACTIVE_BRANCH_NOT_FOUND",
|
|
7811
7881
|
"COMMAND_EXECUTION_FAILED"
|
|
7812
7882
|
]);
|
|
7813
7883
|
var AgentSessionCommandResultSchema = z5.object({
|
|
@@ -7820,6 +7890,10 @@ var AgentSessionCommandResultSchema = z5.object({
|
|
|
7820
7890
|
sessionStatus: AgentSessionStatusSchema,
|
|
7821
7891
|
acceptedSequence: z5.number().int().nonnegative().optional(),
|
|
7822
7892
|
resultEventIds: z5.array(ContractIdentifierSchema).default([]),
|
|
7893
|
+
operation: z5.object({
|
|
7894
|
+
lineage: AgentSessionLineageSchema,
|
|
7895
|
+
activeBranch: AgentSessionActiveBranchSchema
|
|
7896
|
+
}).strict().optional(),
|
|
7823
7897
|
termination: z5.enum(["requested", "confirmed"]).optional(),
|
|
7824
7898
|
error: z5.object({
|
|
7825
7899
|
code: AgentSessionCommandErrorCodeSchema,
|
|
@@ -7850,6 +7924,97 @@ var AgentSessionCommandResultSchema = z5.object({
|
|
|
7850
7924
|
message: "A confirmed termination requires a terminal run status."
|
|
7851
7925
|
});
|
|
7852
7926
|
}
|
|
7927
|
+
if (value.operation && !value.operation.activeBranch.lineage) {
|
|
7928
|
+
context.addIssue({
|
|
7929
|
+
code: "custom",
|
|
7930
|
+
path: ["operation", "activeBranch", "lineage"],
|
|
7931
|
+
message: "A branch operation result requires lineage on its active branch."
|
|
7932
|
+
});
|
|
7933
|
+
}
|
|
7934
|
+
const operation = value.operation;
|
|
7935
|
+
if (operation?.activeBranch.lineage) {
|
|
7936
|
+
const { lineage } = operation;
|
|
7937
|
+
const branchLineage = operation.activeBranch.lineage;
|
|
7938
|
+
if (lineage.forkedFromThreadId !== branchLineage.forkedFromThreadId || lineage.forkedFromMessageId !== branchLineage.forkedFromMessageId || lineage.sourceRunId !== branchLineage.sourceRunId) {
|
|
7939
|
+
context.addIssue({
|
|
7940
|
+
code: "custom",
|
|
7941
|
+
path: ["operation", "activeBranch", "lineage"],
|
|
7942
|
+
message: "Active branch lineage must match the operation lineage."
|
|
7943
|
+
});
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
if (value.operation && value.runId !== value.operation.activeBranch.runId) {
|
|
7947
|
+
context.addIssue({
|
|
7948
|
+
code: "custom",
|
|
7949
|
+
path: ["operation", "activeBranch", "runId"],
|
|
7950
|
+
message: "Active branch runId must match the command result runId."
|
|
7951
|
+
});
|
|
7952
|
+
}
|
|
7953
|
+
});
|
|
7954
|
+
var AgentSessionCommandPolicySchema = z5.object({
|
|
7955
|
+
capability: AgentSessionCapabilitySchema.optional(),
|
|
7956
|
+
allowedStatuses: z5.array(AgentSessionStatusSchema).min(1),
|
|
7957
|
+
requiresRunId: z5.boolean(),
|
|
7958
|
+
sourceSessionEffect: z5.enum(["transition", "preserve"]),
|
|
7959
|
+
idempotencyScope: z5.literal("session-command"),
|
|
7960
|
+
sequenceRule: z5.literal("match-current")
|
|
7961
|
+
}).strict();
|
|
7962
|
+
var sessionCommandPolicy = (policy) => AgentSessionCommandPolicySchema.parse(policy);
|
|
7963
|
+
var AGENT_SESSION_COMMAND_POLICIES = Object.freeze({
|
|
7964
|
+
stop: sessionCommandPolicy({
|
|
7965
|
+
allowedStatuses: ["queued", "running", "waiting_approval"],
|
|
7966
|
+
requiresRunId: true,
|
|
7967
|
+
sourceSessionEffect: "transition",
|
|
7968
|
+
idempotencyScope: "session-command",
|
|
7969
|
+
sequenceRule: "match-current"
|
|
7970
|
+
}),
|
|
7971
|
+
resume: sessionCommandPolicy({
|
|
7972
|
+
capability: "resume",
|
|
7973
|
+
allowedStatuses: ["stopped", "completed", "failed"],
|
|
7974
|
+
requiresRunId: true,
|
|
7975
|
+
sourceSessionEffect: "transition",
|
|
7976
|
+
idempotencyScope: "session-command",
|
|
7977
|
+
sequenceRule: "match-current"
|
|
7978
|
+
}),
|
|
7979
|
+
retry: sessionCommandPolicy({
|
|
7980
|
+
allowedStatuses: ["failed"],
|
|
7981
|
+
requiresRunId: true,
|
|
7982
|
+
sourceSessionEffect: "transition",
|
|
7983
|
+
idempotencyScope: "session-command",
|
|
7984
|
+
sequenceRule: "match-current"
|
|
7985
|
+
}),
|
|
7986
|
+
approval: sessionCommandPolicy({
|
|
7987
|
+
capability: "approval",
|
|
7988
|
+
allowedStatuses: ["waiting_approval"],
|
|
7989
|
+
requiresRunId: true,
|
|
7990
|
+
sourceSessionEffect: "transition",
|
|
7991
|
+
idempotencyScope: "session-command",
|
|
7992
|
+
sequenceRule: "match-current"
|
|
7993
|
+
}),
|
|
7994
|
+
fork: sessionCommandPolicy({
|
|
7995
|
+
capability: "threadForking",
|
|
7996
|
+
allowedStatuses: AgentSessionStatusSchema.options,
|
|
7997
|
+
requiresRunId: false,
|
|
7998
|
+
sourceSessionEffect: "preserve",
|
|
7999
|
+
idempotencyScope: "session-command",
|
|
8000
|
+
sequenceRule: "match-current"
|
|
8001
|
+
}),
|
|
8002
|
+
"edit-and-rerun": sessionCommandPolicy({
|
|
8003
|
+
capability: "editAndRerun",
|
|
8004
|
+
allowedStatuses: ["stopped", "completed", "failed"],
|
|
8005
|
+
requiresRunId: false,
|
|
8006
|
+
sourceSessionEffect: "preserve",
|
|
8007
|
+
idempotencyScope: "session-command",
|
|
8008
|
+
sequenceRule: "match-current"
|
|
8009
|
+
}),
|
|
8010
|
+
steer: sessionCommandPolicy({
|
|
8011
|
+
capability: "steering",
|
|
8012
|
+
allowedStatuses: ["queued", "running"],
|
|
8013
|
+
requiresRunId: true,
|
|
8014
|
+
sourceSessionEffect: "preserve",
|
|
8015
|
+
idempotencyScope: "session-command",
|
|
8016
|
+
sequenceRule: "match-current"
|
|
8017
|
+
})
|
|
7853
8018
|
});
|
|
7854
8019
|
function isAgentSessionTerminalStatus(status) {
|
|
7855
8020
|
return AgentSessionTerminalStatusSchema.safeParse(status).success;
|
|
@@ -7979,8 +8144,24 @@ var AgentSessionEventSchema = z5.discriminatedUnion("eventType", [
|
|
|
7979
8144
|
status: z5.enum(["running", "passed", "failed", "skipped"]),
|
|
7980
8145
|
durationMs: z5.number().nonnegative().optional(),
|
|
7981
8146
|
output: z5.string().optional()
|
|
8147
|
+
}),
|
|
8148
|
+
sessionEvent("summary", {
|
|
8149
|
+
summaryId: ContractIdentifierSchema,
|
|
8150
|
+
runId: ContractIdentifierSchema,
|
|
8151
|
+
text: z5.string(),
|
|
8152
|
+
highlights: z5.array(z5.string()),
|
|
8153
|
+
pendingItems: z5.array(z5.string()),
|
|
8154
|
+
status: z5.enum(["generating", "completed", "failed"])
|
|
7982
8155
|
})
|
|
7983
|
-
])
|
|
8156
|
+
]).superRefine((value, context) => {
|
|
8157
|
+
if (value.eventType === "summary" && value.runId !== value.payload.runId) {
|
|
8158
|
+
context.addIssue({
|
|
8159
|
+
code: "custom",
|
|
8160
|
+
path: ["payload", "runId"],
|
|
8161
|
+
message: "Summary payload runId must match the event runId."
|
|
8162
|
+
});
|
|
8163
|
+
}
|
|
8164
|
+
});
|
|
7984
8165
|
var AgentSessionRunEventSchema = AgentSessionEventSchema.superRefine((value, context) => {
|
|
7985
8166
|
if (!value.runId) {
|
|
7986
8167
|
context.addIssue({ code: "custom", path: ["runId"], message: "Run events require runId." });
|
|
@@ -8016,7 +8197,9 @@ var AgentSessionViewModelSchema = z5.object({
|
|
|
8016
8197
|
status: AgentSessionStatusSchema,
|
|
8017
8198
|
events: z5.array(AgentSessionEventSchema),
|
|
8018
8199
|
lastSequence: z5.number().int().min(-1),
|
|
8019
|
-
resumable: z5.boolean().default(false)
|
|
8200
|
+
resumable: z5.boolean().default(false),
|
|
8201
|
+
lineage: AgentSessionLineageSchema.optional(),
|
|
8202
|
+
activeBranch: AgentSessionActiveBranchSchema.optional()
|
|
8020
8203
|
}).strict().superRefine((value, context) => {
|
|
8021
8204
|
const eventIds = /* @__PURE__ */ new Set();
|
|
8022
8205
|
const idempotencyKeys = /* @__PURE__ */ new Set();
|