@inf-monkeys-tech/monkeys 1.0.11 → 1.0.13

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.
@@ -709,12 +709,12 @@ export declare const RadarActionRecordSchema: z.ZodObject<{
709
709
  ownerRepo: z.ZodOptional<z.ZodString>;
710
710
  }, z.core.$strict>;
711
711
  action: z.ZodEnum<{
712
+ retry: "retry";
712
713
  select: "select";
713
714
  stash: "stash";
714
715
  reject: "reject";
715
716
  archive: "archive";
716
717
  launch: "launch";
717
- retry: "retry";
718
718
  replay: "replay";
719
719
  rollback: "rollback";
720
720
  }>;
@@ -6653,6 +6653,48 @@ var OutputRecordSchema = z2.object({
6653
6653
  // src/contracts/agent.ts
6654
6654
  import { z as z3 } from "zod";
6655
6655
  var AgentModeSchema = z3.enum(["chatbot", "agent"]);
6656
+ var AgentConfigurationCapabilitySchema = z3.enum([
6657
+ "models",
6658
+ "skills",
6659
+ "tools",
6660
+ "mcp",
6661
+ "reasoning"
6662
+ ]);
6663
+ var AgentModeCapabilitiesSchema = z3.object({
6664
+ models: z3.boolean(),
6665
+ skills: z3.boolean(),
6666
+ tools: z3.boolean(),
6667
+ mcp: z3.boolean(),
6668
+ reasoning: z3.boolean()
6669
+ }).strict();
6670
+ var AgentResourceModeSupportSchema = z3.object({
6671
+ modes: z3.array(AgentModeSchema).min(1)
6672
+ }).strict();
6673
+ var AGENT_MODE_CAPABILITIES = Object.freeze({
6674
+ chatbot: AgentModeCapabilitiesSchema.parse({
6675
+ models: true,
6676
+ skills: true,
6677
+ tools: true,
6678
+ mcp: true,
6679
+ reasoning: false
6680
+ }),
6681
+ agent: AgentModeCapabilitiesSchema.parse({
6682
+ models: true,
6683
+ skills: true,
6684
+ tools: true,
6685
+ mcp: true,
6686
+ reasoning: true
6687
+ })
6688
+ });
6689
+ function getAgentModeCapabilities(mode) {
6690
+ return AGENT_MODE_CAPABILITIES[mode];
6691
+ }
6692
+ function agentModeHasCapability(mode, capability) {
6693
+ return getAgentModeCapabilities(mode)[capability];
6694
+ }
6695
+ function isAgentResourceModeCompatible(support, mode) {
6696
+ return support?.modes.includes(mode) ?? false;
6697
+ }
6656
6698
  var AgentSessionCapabilitySchema = z3.enum([
6657
6699
  "text",
6658
6700
  "reasoning",
@@ -6696,6 +6738,90 @@ var AgentSessionSnapshotSchema = z3.object({
6696
6738
  modelId: z3.string().trim().min(1),
6697
6739
  capabilities: AgentSessionCapabilitiesSchema
6698
6740
  }).strict();
6741
+ var AgentSessionStatusSchema = z3.enum([
6742
+ "queued",
6743
+ "running",
6744
+ "waiting_approval",
6745
+ "stopping",
6746
+ "stopped",
6747
+ "completed",
6748
+ "failed"
6749
+ ]);
6750
+ var AgentSessionCommandTypeSchema = z3.enum(["stop", "resume", "retry", "approval"]);
6751
+ var AgentSessionCommandHeaderSchema = z3.object({
6752
+ contract: z3.literal("AgentSessionCommand"),
6753
+ commandId: ContractIdentifierSchema,
6754
+ sessionId: ContractIdentifierSchema,
6755
+ idempotencyKey: ContractIdentifierSchema,
6756
+ expectedSequence: z3.number().int().min(-1),
6757
+ issuedAt: IsoDateTimeSchema
6758
+ }).strict();
6759
+ var sessionCommand = (commandType, payload) => AgentSessionCommandHeaderSchema.extend({
6760
+ commandType: z3.literal(commandType),
6761
+ payload: z3.object(payload).strict()
6762
+ }).strict();
6763
+ var AgentSessionCommandSchema = z3.discriminatedUnion("commandType", [
6764
+ sessionCommand("stop", {
6765
+ reason: z3.string().trim().min(1).optional()
6766
+ }),
6767
+ sessionCommand("resume", {
6768
+ resumeEventId: ContractIdentifierSchema.optional()
6769
+ }),
6770
+ sessionCommand("retry", {
6771
+ sourceEventId: ContractIdentifierSchema
6772
+ }),
6773
+ sessionCommand("approval", {
6774
+ approvalId: ContractIdentifierSchema,
6775
+ decision: z3.enum(["approved", "rejected"]),
6776
+ reason: z3.string().trim().min(1).optional()
6777
+ })
6778
+ ]);
6779
+ var AgentSessionCommandErrorCodeSchema = z3.enum([
6780
+ "SESSION_NOT_FOUND",
6781
+ "COMMAND_NOT_SUPPORTED",
6782
+ "CAPABILITY_UNAVAILABLE",
6783
+ "SEQUENCE_CONFLICT",
6784
+ "INVALID_SESSION_STATE",
6785
+ "TARGET_EVENT_NOT_FOUND",
6786
+ "TARGET_EVENT_NOT_RETRYABLE",
6787
+ "APPROVAL_NOT_FOUND",
6788
+ "APPROVAL_ALREADY_RESOLVED",
6789
+ "COMMAND_EXECUTION_FAILED"
6790
+ ]);
6791
+ var AgentSessionCommandResultSchema = z3.object({
6792
+ contract: z3.literal("AgentSessionCommandResult"),
6793
+ commandId: ContractIdentifierSchema,
6794
+ sessionId: ContractIdentifierSchema,
6795
+ idempotencyKey: ContractIdentifierSchema,
6796
+ outcome: z3.enum(["accepted", "duplicate", "rejected", "failed"]),
6797
+ sessionStatus: AgentSessionStatusSchema,
6798
+ acceptedSequence: z3.number().int().nonnegative().optional(),
6799
+ resultEventIds: z3.array(ContractIdentifierSchema).default([]),
6800
+ error: z3.object({
6801
+ code: AgentSessionCommandErrorCodeSchema,
6802
+ message: z3.string(),
6803
+ retryable: z3.boolean()
6804
+ }).strict().optional(),
6805
+ occurredAt: IsoDateTimeSchema
6806
+ }).strict().superRefine((value, context) => {
6807
+ const requiresError = value.outcome === "rejected" || value.outcome === "failed";
6808
+ if (requiresError !== Boolean(value.error)) {
6809
+ context.addIssue({
6810
+ code: "custom",
6811
+ path: ["error"],
6812
+ message: requiresError ? "Rejected and failed command results require an error." : "Accepted and duplicate command results must not contain an error."
6813
+ });
6814
+ }
6815
+ });
6816
+ var AGENT_SESSION_COMMAND_TRANSITIONS = {
6817
+ stop: { queued: "stopping", running: "stopping", waiting_approval: "stopping" },
6818
+ resume: { stopped: "queued", completed: "queued", failed: "queued" },
6819
+ retry: { failed: "queued" },
6820
+ approval: { waiting_approval: "running" }
6821
+ };
6822
+ function resolveAgentSessionCommandTransition(status, commandType) {
6823
+ return AGENT_SESSION_COMMAND_TRANSITIONS[commandType][status];
6824
+ }
6699
6825
  var AgentSessionEventHeaderSchema = z3.object({
6700
6826
  contract: z3.literal("AgentSessionEvent"),
6701
6827
  eventId: ContractIdentifierSchema,
@@ -6758,7 +6884,7 @@ var AgentSessionEventSchema = z3.discriminatedUnion("eventType", [
6758
6884
  requestedAction: JsonValueSchema.optional()
6759
6885
  }),
6760
6886
  sessionEvent("status", {
6761
- status: z3.enum(["queued", "running", "waiting_approval", "stopping", "stopped", "completed", "failed"]),
6887
+ status: AgentSessionStatusSchema,
6762
6888
  detail: z3.string().optional()
6763
6889
  }),
6764
6890
  sessionEvent("artifact", {
@@ -6819,7 +6945,7 @@ var AgentSessionViewModelSchema = z3.object({
6819
6945
  contract: z3.literal("AgentSessionViewModel"),
6820
6946
  sessionId: ContractIdentifierSchema,
6821
6947
  snapshot: AgentSessionSnapshotSchema,
6822
- status: z3.enum(["queued", "running", "waiting_approval", "stopping", "stopped", "completed", "failed"]),
6948
+ status: AgentSessionStatusSchema,
6823
6949
  events: z3.array(AgentSessionEventSchema),
6824
6950
  lastSequence: z3.number().int().min(-1),
6825
6951
  resumable: z3.boolean().default(false)
@@ -11285,14 +11411,23 @@ var WorkflowDefinitionSchema = z14.object({
11285
11411
  if (definition.revision.kind === "release" && definition.metadata.version !== definition.revision.recordVersion) context.addIssue({ code: "custom", path: ["revision", "recordVersion"], message: "Release recordVersion must equal metadata.version." });
11286
11412
  });
11287
11413
  export {
11414
+ AGENT_MODE_CAPABILITIES,
11288
11415
  ActorRefSchema,
11416
+ AgentConfigurationCapabilitySchema,
11289
11417
  AgentExecutionModeSchema,
11418
+ AgentModeCapabilitiesSchema,
11290
11419
  AgentModeSchema,
11420
+ AgentResourceModeSupportSchema,
11291
11421
  AgentRuntimeEventSchema,
11292
11422
  AgentSessionCapabilitiesSchema,
11293
11423
  AgentSessionCapabilitySchema,
11424
+ AgentSessionCommandErrorCodeSchema,
11425
+ AgentSessionCommandResultSchema,
11426
+ AgentSessionCommandSchema,
11427
+ AgentSessionCommandTypeSchema,
11294
11428
  AgentSessionEventSchema,
11295
11429
  AgentSessionSnapshotSchema,
11430
+ AgentSessionStatusSchema,
11296
11431
  AgentSessionViewModelSchema,
11297
11432
  ApplicationHandoffEndpointSchema,
11298
11433
  ApplicationHandoffSchema,
@@ -11419,7 +11554,11 @@ export {
11419
11554
  WorkflowParameterTypeSchema,
11420
11555
  WorkflowTriggerSchema,
11421
11556
  WorkflowValidationIssueSchema,
11557
+ agentModeHasCapability,
11558
+ getAgentModeCapabilities,
11559
+ isAgentResourceModeCompatible,
11422
11560
  normalizeAgentExecutionMode,
11423
- normalizeAgentMode
11561
+ normalizeAgentMode,
11562
+ resolveAgentSessionCommandTransition
11424
11563
  };
11425
11564
  //# sourceMappingURL=index.mjs.map