@inf-monkeys-tech/monkeys 1.0.10 → 1.0.12
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 +148 -25
- package/lib/contracts/agent.d.ts.map +1 -1
- package/lib/contracts/agent.js +98 -3
- package/lib/contracts/agent.js.map +1 -1
- package/lib/contracts/context.d.ts +1 -0
- package/lib/contracts/context.d.ts.map +1 -1
- package/lib/contracts/context.js +1 -1
- package/lib/contracts/context.js.map +1 -1
- package/lib/contracts/trend.d.ts +1 -1
- package/lib/esm/contracts/index.mjs +94 -4
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +95 -3
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +85 -3
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/agent-runtime-event.schema.json +2 -1
- package/lib/json-schema/agent-session-command-result.schema.json +110 -0
- package/lib/json-schema/agent-session-command.schema.json +264 -0
- package/lib/json-schema/index.json +2 -0
- package/lib/schemas/index.d.ts +118 -27
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +10 -3
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -6733,6 +6733,90 @@ var AgentSessionSnapshotSchema = z3.object({
|
|
|
6733
6733
|
modelId: z3.string().trim().min(1),
|
|
6734
6734
|
capabilities: AgentSessionCapabilitiesSchema
|
|
6735
6735
|
}).strict();
|
|
6736
|
+
var AgentSessionStatusSchema = z3.enum([
|
|
6737
|
+
"queued",
|
|
6738
|
+
"running",
|
|
6739
|
+
"waiting_approval",
|
|
6740
|
+
"stopping",
|
|
6741
|
+
"stopped",
|
|
6742
|
+
"completed",
|
|
6743
|
+
"failed"
|
|
6744
|
+
]);
|
|
6745
|
+
var AgentSessionCommandTypeSchema = z3.enum(["stop", "resume", "retry", "approval"]);
|
|
6746
|
+
var AgentSessionCommandHeaderSchema = z3.object({
|
|
6747
|
+
contract: z3.literal("AgentSessionCommand"),
|
|
6748
|
+
commandId: ContractIdentifierSchema,
|
|
6749
|
+
sessionId: ContractIdentifierSchema,
|
|
6750
|
+
idempotencyKey: ContractIdentifierSchema,
|
|
6751
|
+
expectedSequence: z3.number().int().min(-1),
|
|
6752
|
+
issuedAt: IsoDateTimeSchema
|
|
6753
|
+
}).strict();
|
|
6754
|
+
var sessionCommand = (commandType, payload) => AgentSessionCommandHeaderSchema.extend({
|
|
6755
|
+
commandType: z3.literal(commandType),
|
|
6756
|
+
payload: z3.object(payload).strict()
|
|
6757
|
+
}).strict();
|
|
6758
|
+
var AgentSessionCommandSchema = z3.discriminatedUnion("commandType", [
|
|
6759
|
+
sessionCommand("stop", {
|
|
6760
|
+
reason: z3.string().trim().min(1).optional()
|
|
6761
|
+
}),
|
|
6762
|
+
sessionCommand("resume", {
|
|
6763
|
+
resumeEventId: ContractIdentifierSchema.optional()
|
|
6764
|
+
}),
|
|
6765
|
+
sessionCommand("retry", {
|
|
6766
|
+
sourceEventId: ContractIdentifierSchema
|
|
6767
|
+
}),
|
|
6768
|
+
sessionCommand("approval", {
|
|
6769
|
+
approvalId: ContractIdentifierSchema,
|
|
6770
|
+
decision: z3.enum(["approved", "rejected"]),
|
|
6771
|
+
reason: z3.string().trim().min(1).optional()
|
|
6772
|
+
})
|
|
6773
|
+
]);
|
|
6774
|
+
var AgentSessionCommandErrorCodeSchema = z3.enum([
|
|
6775
|
+
"SESSION_NOT_FOUND",
|
|
6776
|
+
"COMMAND_NOT_SUPPORTED",
|
|
6777
|
+
"CAPABILITY_UNAVAILABLE",
|
|
6778
|
+
"SEQUENCE_CONFLICT",
|
|
6779
|
+
"INVALID_SESSION_STATE",
|
|
6780
|
+
"TARGET_EVENT_NOT_FOUND",
|
|
6781
|
+
"TARGET_EVENT_NOT_RETRYABLE",
|
|
6782
|
+
"APPROVAL_NOT_FOUND",
|
|
6783
|
+
"APPROVAL_ALREADY_RESOLVED",
|
|
6784
|
+
"COMMAND_EXECUTION_FAILED"
|
|
6785
|
+
]);
|
|
6786
|
+
var AgentSessionCommandResultSchema = z3.object({
|
|
6787
|
+
contract: z3.literal("AgentSessionCommandResult"),
|
|
6788
|
+
commandId: ContractIdentifierSchema,
|
|
6789
|
+
sessionId: ContractIdentifierSchema,
|
|
6790
|
+
idempotencyKey: ContractIdentifierSchema,
|
|
6791
|
+
outcome: z3.enum(["accepted", "duplicate", "rejected", "failed"]),
|
|
6792
|
+
sessionStatus: AgentSessionStatusSchema,
|
|
6793
|
+
acceptedSequence: z3.number().int().nonnegative().optional(),
|
|
6794
|
+
resultEventIds: z3.array(ContractIdentifierSchema).default([]),
|
|
6795
|
+
error: z3.object({
|
|
6796
|
+
code: AgentSessionCommandErrorCodeSchema,
|
|
6797
|
+
message: z3.string(),
|
|
6798
|
+
retryable: z3.boolean()
|
|
6799
|
+
}).strict().optional(),
|
|
6800
|
+
occurredAt: IsoDateTimeSchema
|
|
6801
|
+
}).strict().superRefine((value, context) => {
|
|
6802
|
+
const requiresError = value.outcome === "rejected" || value.outcome === "failed";
|
|
6803
|
+
if (requiresError !== Boolean(value.error)) {
|
|
6804
|
+
context.addIssue({
|
|
6805
|
+
code: "custom",
|
|
6806
|
+
path: ["error"],
|
|
6807
|
+
message: requiresError ? "Rejected and failed command results require an error." : "Accepted and duplicate command results must not contain an error."
|
|
6808
|
+
});
|
|
6809
|
+
}
|
|
6810
|
+
});
|
|
6811
|
+
var AGENT_SESSION_COMMAND_TRANSITIONS = {
|
|
6812
|
+
stop: { queued: "stopping", running: "stopping", waiting_approval: "stopping" },
|
|
6813
|
+
resume: { stopped: "queued", completed: "queued", failed: "queued" },
|
|
6814
|
+
retry: { failed: "queued" },
|
|
6815
|
+
approval: { waiting_approval: "running" }
|
|
6816
|
+
};
|
|
6817
|
+
function resolveAgentSessionCommandTransition(status, commandType) {
|
|
6818
|
+
return AGENT_SESSION_COMMAND_TRANSITIONS[commandType][status];
|
|
6819
|
+
}
|
|
6736
6820
|
var AgentSessionEventHeaderSchema = z3.object({
|
|
6737
6821
|
contract: z3.literal("AgentSessionEvent"),
|
|
6738
6822
|
eventId: ContractIdentifierSchema,
|
|
@@ -6795,7 +6879,7 @@ var AgentSessionEventSchema = z3.discriminatedUnion("eventType", [
|
|
|
6795
6879
|
requestedAction: JsonValueSchema.optional()
|
|
6796
6880
|
}),
|
|
6797
6881
|
sessionEvent("status", {
|
|
6798
|
-
status:
|
|
6882
|
+
status: AgentSessionStatusSchema,
|
|
6799
6883
|
detail: z3.string().optional()
|
|
6800
6884
|
}),
|
|
6801
6885
|
sessionEvent("artifact", {
|
|
@@ -6856,7 +6940,7 @@ var AgentSessionViewModelSchema = z3.object({
|
|
|
6856
6940
|
contract: z3.literal("AgentSessionViewModel"),
|
|
6857
6941
|
sessionId: ContractIdentifierSchema,
|
|
6858
6942
|
snapshot: AgentSessionSnapshotSchema,
|
|
6859
|
-
status:
|
|
6943
|
+
status: AgentSessionStatusSchema,
|
|
6860
6944
|
events: z3.array(AgentSessionEventSchema),
|
|
6861
6945
|
lastSequence: z3.number().int().min(-1),
|
|
6862
6946
|
resumable: z3.boolean().default(false)
|
|
@@ -7426,7 +7510,7 @@ var AgentRuntimeEventSchema = z6.object({
|
|
|
7426
7510
|
requestId: ContractIdentifierSchema,
|
|
7427
7511
|
teamId: ContractIdentifierSchema,
|
|
7428
7512
|
threadId: ContractIdentifierSchema.optional(),
|
|
7429
|
-
eventType: z6.enum(["messages:append", "messages:update", "thread:update", "tool-call:upsert"]),
|
|
7513
|
+
eventType: z6.enum(["messages:append", "messages:update", "thread:update", "tool-call:upsert", "session:event"]),
|
|
7430
7514
|
payload: JsonValueSchema,
|
|
7431
7515
|
occurredAt: IsoDateTimeSchema
|
|
7432
7516
|
}).strict();
|
|
@@ -11357,6 +11441,8 @@ var WorkflowDefinitionSchema = z14.object({
|
|
|
11357
11441
|
|
|
11358
11442
|
// src/schemas/index.ts
|
|
11359
11443
|
var canonicalContractSchemas = {
|
|
11444
|
+
"agent-session-command": AgentSessionCommandSchema,
|
|
11445
|
+
"agent-session-command-result": AgentSessionCommandResultSchema,
|
|
11360
11446
|
"agent-session-event": AgentSessionEventSchema,
|
|
11361
11447
|
"agent-session-view-model": AgentSessionViewModelSchema,
|
|
11362
11448
|
"agent-runtime-event": AgentRuntimeEventSchema,
|
|
@@ -12557,8 +12643,13 @@ export {
|
|
|
12557
12643
|
AgentRuntimeEventSchema,
|
|
12558
12644
|
AgentSessionCapabilitiesSchema,
|
|
12559
12645
|
AgentSessionCapabilitySchema,
|
|
12646
|
+
AgentSessionCommandErrorCodeSchema,
|
|
12647
|
+
AgentSessionCommandResultSchema,
|
|
12648
|
+
AgentSessionCommandSchema,
|
|
12649
|
+
AgentSessionCommandTypeSchema,
|
|
12560
12650
|
AgentSessionEventSchema,
|
|
12561
12651
|
AgentSessionSnapshotSchema,
|
|
12652
|
+
AgentSessionStatusSchema,
|
|
12562
12653
|
AgentSessionViewModelSchema,
|
|
12563
12654
|
ApplicationHandoffEndpointSchema,
|
|
12564
12655
|
ApplicationHandoffSchema,
|
|
@@ -12723,6 +12814,7 @@ export {
|
|
|
12723
12814
|
parseApplicationHandoff,
|
|
12724
12815
|
publishOpenApiToolCapabilityManifests,
|
|
12725
12816
|
readApplicationHandoffFromUrl,
|
|
12817
|
+
resolveAgentSessionCommandTransition,
|
|
12726
12818
|
resolveThemeTokens,
|
|
12727
12819
|
serializeApplicationHandoff,
|
|
12728
12820
|
validateDomainCommand,
|