@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.
@@ -6696,6 +6696,90 @@ var AgentSessionSnapshotSchema = z3.object({
6696
6696
  modelId: z3.string().trim().min(1),
6697
6697
  capabilities: AgentSessionCapabilitiesSchema
6698
6698
  }).strict();
6699
+ var AgentSessionStatusSchema = z3.enum([
6700
+ "queued",
6701
+ "running",
6702
+ "waiting_approval",
6703
+ "stopping",
6704
+ "stopped",
6705
+ "completed",
6706
+ "failed"
6707
+ ]);
6708
+ var AgentSessionCommandTypeSchema = z3.enum(["stop", "resume", "retry", "approval"]);
6709
+ var AgentSessionCommandHeaderSchema = z3.object({
6710
+ contract: z3.literal("AgentSessionCommand"),
6711
+ commandId: ContractIdentifierSchema,
6712
+ sessionId: ContractIdentifierSchema,
6713
+ idempotencyKey: ContractIdentifierSchema,
6714
+ expectedSequence: z3.number().int().min(-1),
6715
+ issuedAt: IsoDateTimeSchema
6716
+ }).strict();
6717
+ var sessionCommand = (commandType, payload) => AgentSessionCommandHeaderSchema.extend({
6718
+ commandType: z3.literal(commandType),
6719
+ payload: z3.object(payload).strict()
6720
+ }).strict();
6721
+ var AgentSessionCommandSchema = z3.discriminatedUnion("commandType", [
6722
+ sessionCommand("stop", {
6723
+ reason: z3.string().trim().min(1).optional()
6724
+ }),
6725
+ sessionCommand("resume", {
6726
+ resumeEventId: ContractIdentifierSchema.optional()
6727
+ }),
6728
+ sessionCommand("retry", {
6729
+ sourceEventId: ContractIdentifierSchema
6730
+ }),
6731
+ sessionCommand("approval", {
6732
+ approvalId: ContractIdentifierSchema,
6733
+ decision: z3.enum(["approved", "rejected"]),
6734
+ reason: z3.string().trim().min(1).optional()
6735
+ })
6736
+ ]);
6737
+ var AgentSessionCommandErrorCodeSchema = z3.enum([
6738
+ "SESSION_NOT_FOUND",
6739
+ "COMMAND_NOT_SUPPORTED",
6740
+ "CAPABILITY_UNAVAILABLE",
6741
+ "SEQUENCE_CONFLICT",
6742
+ "INVALID_SESSION_STATE",
6743
+ "TARGET_EVENT_NOT_FOUND",
6744
+ "TARGET_EVENT_NOT_RETRYABLE",
6745
+ "APPROVAL_NOT_FOUND",
6746
+ "APPROVAL_ALREADY_RESOLVED",
6747
+ "COMMAND_EXECUTION_FAILED"
6748
+ ]);
6749
+ var AgentSessionCommandResultSchema = z3.object({
6750
+ contract: z3.literal("AgentSessionCommandResult"),
6751
+ commandId: ContractIdentifierSchema,
6752
+ sessionId: ContractIdentifierSchema,
6753
+ idempotencyKey: ContractIdentifierSchema,
6754
+ outcome: z3.enum(["accepted", "duplicate", "rejected", "failed"]),
6755
+ sessionStatus: AgentSessionStatusSchema,
6756
+ acceptedSequence: z3.number().int().nonnegative().optional(),
6757
+ resultEventIds: z3.array(ContractIdentifierSchema).default([]),
6758
+ error: z3.object({
6759
+ code: AgentSessionCommandErrorCodeSchema,
6760
+ message: z3.string(),
6761
+ retryable: z3.boolean()
6762
+ }).strict().optional(),
6763
+ occurredAt: IsoDateTimeSchema
6764
+ }).strict().superRefine((value, context) => {
6765
+ const requiresError = value.outcome === "rejected" || value.outcome === "failed";
6766
+ if (requiresError !== Boolean(value.error)) {
6767
+ context.addIssue({
6768
+ code: "custom",
6769
+ path: ["error"],
6770
+ message: requiresError ? "Rejected and failed command results require an error." : "Accepted and duplicate command results must not contain an error."
6771
+ });
6772
+ }
6773
+ });
6774
+ var AGENT_SESSION_COMMAND_TRANSITIONS = {
6775
+ stop: { queued: "stopping", running: "stopping", waiting_approval: "stopping" },
6776
+ resume: { stopped: "queued", completed: "queued", failed: "queued" },
6777
+ retry: { failed: "queued" },
6778
+ approval: { waiting_approval: "running" }
6779
+ };
6780
+ function resolveAgentSessionCommandTransition(status, commandType) {
6781
+ return AGENT_SESSION_COMMAND_TRANSITIONS[commandType][status];
6782
+ }
6699
6783
  var AgentSessionEventHeaderSchema = z3.object({
6700
6784
  contract: z3.literal("AgentSessionEvent"),
6701
6785
  eventId: ContractIdentifierSchema,
@@ -6758,7 +6842,7 @@ var AgentSessionEventSchema = z3.discriminatedUnion("eventType", [
6758
6842
  requestedAction: JsonValueSchema.optional()
6759
6843
  }),
6760
6844
  sessionEvent("status", {
6761
- status: z3.enum(["queued", "running", "waiting_approval", "stopping", "stopped", "completed", "failed"]),
6845
+ status: AgentSessionStatusSchema,
6762
6846
  detail: z3.string().optional()
6763
6847
  }),
6764
6848
  sessionEvent("artifact", {
@@ -6819,7 +6903,7 @@ var AgentSessionViewModelSchema = z3.object({
6819
6903
  contract: z3.literal("AgentSessionViewModel"),
6820
6904
  sessionId: ContractIdentifierSchema,
6821
6905
  snapshot: AgentSessionSnapshotSchema,
6822
- status: z3.enum(["queued", "running", "waiting_approval", "stopping", "stopped", "completed", "failed"]),
6906
+ status: AgentSessionStatusSchema,
6823
6907
  events: z3.array(AgentSessionEventSchema),
6824
6908
  lastSequence: z3.number().int().min(-1),
6825
6909
  resumable: z3.boolean().default(false)
@@ -7389,7 +7473,7 @@ var AgentRuntimeEventSchema = z6.object({
7389
7473
  requestId: ContractIdentifierSchema,
7390
7474
  teamId: ContractIdentifierSchema,
7391
7475
  threadId: ContractIdentifierSchema.optional(),
7392
- eventType: z6.enum(["messages:append", "messages:update", "thread:update", "tool-call:upsert"]),
7476
+ eventType: z6.enum(["messages:append", "messages:update", "thread:update", "tool-call:upsert", "session:event"]),
7393
7477
  payload: JsonValueSchema,
7394
7478
  occurredAt: IsoDateTimeSchema
7395
7479
  }).strict();
@@ -11291,8 +11375,13 @@ export {
11291
11375
  AgentRuntimeEventSchema,
11292
11376
  AgentSessionCapabilitiesSchema,
11293
11377
  AgentSessionCapabilitySchema,
11378
+ AgentSessionCommandErrorCodeSchema,
11379
+ AgentSessionCommandResultSchema,
11380
+ AgentSessionCommandSchema,
11381
+ AgentSessionCommandTypeSchema,
11294
11382
  AgentSessionEventSchema,
11295
11383
  AgentSessionSnapshotSchema,
11384
+ AgentSessionStatusSchema,
11296
11385
  AgentSessionViewModelSchema,
11297
11386
  ApplicationHandoffEndpointSchema,
11298
11387
  ApplicationHandoffSchema,
@@ -11420,6 +11509,7 @@ export {
11420
11509
  WorkflowTriggerSchema,
11421
11510
  WorkflowValidationIssueSchema,
11422
11511
  normalizeAgentExecutionMode,
11423
- normalizeAgentMode
11512
+ normalizeAgentMode,
11513
+ resolveAgentSessionCommandTransition
11424
11514
  };
11425
11515
  //# sourceMappingURL=index.mjs.map