@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.
- package/lib/contracts/agent.d.ts +192 -27
- package/lib/contracts/agent.d.ts.map +1 -1
- package/lib/contracts/agent.js +147 -3
- package/lib/contracts/agent.js.map +1 -1
- package/lib/contracts/trend.d.ts +1 -1
- package/lib/esm/contracts/index.mjs +142 -3
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +143 -2
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +120 -2
- package/lib/esm/schemas/index.mjs.map +1 -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 +117 -27
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +13 -3
- package/lib/schemas/index.js.map +1 -1
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -6690,6 +6690,48 @@ var OutputRecordSchema = z2.object({
|
|
|
6690
6690
|
// src/contracts/agent.ts
|
|
6691
6691
|
import { z as z3 } from "zod";
|
|
6692
6692
|
var AgentModeSchema = z3.enum(["chatbot", "agent"]);
|
|
6693
|
+
var AgentConfigurationCapabilitySchema = z3.enum([
|
|
6694
|
+
"models",
|
|
6695
|
+
"skills",
|
|
6696
|
+
"tools",
|
|
6697
|
+
"mcp",
|
|
6698
|
+
"reasoning"
|
|
6699
|
+
]);
|
|
6700
|
+
var AgentModeCapabilitiesSchema = z3.object({
|
|
6701
|
+
models: z3.boolean(),
|
|
6702
|
+
skills: z3.boolean(),
|
|
6703
|
+
tools: z3.boolean(),
|
|
6704
|
+
mcp: z3.boolean(),
|
|
6705
|
+
reasoning: z3.boolean()
|
|
6706
|
+
}).strict();
|
|
6707
|
+
var AgentResourceModeSupportSchema = z3.object({
|
|
6708
|
+
modes: z3.array(AgentModeSchema).min(1)
|
|
6709
|
+
}).strict();
|
|
6710
|
+
var AGENT_MODE_CAPABILITIES = Object.freeze({
|
|
6711
|
+
chatbot: AgentModeCapabilitiesSchema.parse({
|
|
6712
|
+
models: true,
|
|
6713
|
+
skills: true,
|
|
6714
|
+
tools: true,
|
|
6715
|
+
mcp: true,
|
|
6716
|
+
reasoning: false
|
|
6717
|
+
}),
|
|
6718
|
+
agent: AgentModeCapabilitiesSchema.parse({
|
|
6719
|
+
models: true,
|
|
6720
|
+
skills: true,
|
|
6721
|
+
tools: true,
|
|
6722
|
+
mcp: true,
|
|
6723
|
+
reasoning: true
|
|
6724
|
+
})
|
|
6725
|
+
});
|
|
6726
|
+
function getAgentModeCapabilities(mode) {
|
|
6727
|
+
return AGENT_MODE_CAPABILITIES[mode];
|
|
6728
|
+
}
|
|
6729
|
+
function agentModeHasCapability(mode, capability) {
|
|
6730
|
+
return getAgentModeCapabilities(mode)[capability];
|
|
6731
|
+
}
|
|
6732
|
+
function isAgentResourceModeCompatible(support, mode) {
|
|
6733
|
+
return support?.modes.includes(mode) ?? false;
|
|
6734
|
+
}
|
|
6693
6735
|
var AgentSessionCapabilitySchema = z3.enum([
|
|
6694
6736
|
"text",
|
|
6695
6737
|
"reasoning",
|
|
@@ -6733,6 +6775,90 @@ var AgentSessionSnapshotSchema = z3.object({
|
|
|
6733
6775
|
modelId: z3.string().trim().min(1),
|
|
6734
6776
|
capabilities: AgentSessionCapabilitiesSchema
|
|
6735
6777
|
}).strict();
|
|
6778
|
+
var AgentSessionStatusSchema = z3.enum([
|
|
6779
|
+
"queued",
|
|
6780
|
+
"running",
|
|
6781
|
+
"waiting_approval",
|
|
6782
|
+
"stopping",
|
|
6783
|
+
"stopped",
|
|
6784
|
+
"completed",
|
|
6785
|
+
"failed"
|
|
6786
|
+
]);
|
|
6787
|
+
var AgentSessionCommandTypeSchema = z3.enum(["stop", "resume", "retry", "approval"]);
|
|
6788
|
+
var AgentSessionCommandHeaderSchema = z3.object({
|
|
6789
|
+
contract: z3.literal("AgentSessionCommand"),
|
|
6790
|
+
commandId: ContractIdentifierSchema,
|
|
6791
|
+
sessionId: ContractIdentifierSchema,
|
|
6792
|
+
idempotencyKey: ContractIdentifierSchema,
|
|
6793
|
+
expectedSequence: z3.number().int().min(-1),
|
|
6794
|
+
issuedAt: IsoDateTimeSchema
|
|
6795
|
+
}).strict();
|
|
6796
|
+
var sessionCommand = (commandType, payload) => AgentSessionCommandHeaderSchema.extend({
|
|
6797
|
+
commandType: z3.literal(commandType),
|
|
6798
|
+
payload: z3.object(payload).strict()
|
|
6799
|
+
}).strict();
|
|
6800
|
+
var AgentSessionCommandSchema = z3.discriminatedUnion("commandType", [
|
|
6801
|
+
sessionCommand("stop", {
|
|
6802
|
+
reason: z3.string().trim().min(1).optional()
|
|
6803
|
+
}),
|
|
6804
|
+
sessionCommand("resume", {
|
|
6805
|
+
resumeEventId: ContractIdentifierSchema.optional()
|
|
6806
|
+
}),
|
|
6807
|
+
sessionCommand("retry", {
|
|
6808
|
+
sourceEventId: ContractIdentifierSchema
|
|
6809
|
+
}),
|
|
6810
|
+
sessionCommand("approval", {
|
|
6811
|
+
approvalId: ContractIdentifierSchema,
|
|
6812
|
+
decision: z3.enum(["approved", "rejected"]),
|
|
6813
|
+
reason: z3.string().trim().min(1).optional()
|
|
6814
|
+
})
|
|
6815
|
+
]);
|
|
6816
|
+
var AgentSessionCommandErrorCodeSchema = z3.enum([
|
|
6817
|
+
"SESSION_NOT_FOUND",
|
|
6818
|
+
"COMMAND_NOT_SUPPORTED",
|
|
6819
|
+
"CAPABILITY_UNAVAILABLE",
|
|
6820
|
+
"SEQUENCE_CONFLICT",
|
|
6821
|
+
"INVALID_SESSION_STATE",
|
|
6822
|
+
"TARGET_EVENT_NOT_FOUND",
|
|
6823
|
+
"TARGET_EVENT_NOT_RETRYABLE",
|
|
6824
|
+
"APPROVAL_NOT_FOUND",
|
|
6825
|
+
"APPROVAL_ALREADY_RESOLVED",
|
|
6826
|
+
"COMMAND_EXECUTION_FAILED"
|
|
6827
|
+
]);
|
|
6828
|
+
var AgentSessionCommandResultSchema = z3.object({
|
|
6829
|
+
contract: z3.literal("AgentSessionCommandResult"),
|
|
6830
|
+
commandId: ContractIdentifierSchema,
|
|
6831
|
+
sessionId: ContractIdentifierSchema,
|
|
6832
|
+
idempotencyKey: ContractIdentifierSchema,
|
|
6833
|
+
outcome: z3.enum(["accepted", "duplicate", "rejected", "failed"]),
|
|
6834
|
+
sessionStatus: AgentSessionStatusSchema,
|
|
6835
|
+
acceptedSequence: z3.number().int().nonnegative().optional(),
|
|
6836
|
+
resultEventIds: z3.array(ContractIdentifierSchema).default([]),
|
|
6837
|
+
error: z3.object({
|
|
6838
|
+
code: AgentSessionCommandErrorCodeSchema,
|
|
6839
|
+
message: z3.string(),
|
|
6840
|
+
retryable: z3.boolean()
|
|
6841
|
+
}).strict().optional(),
|
|
6842
|
+
occurredAt: IsoDateTimeSchema
|
|
6843
|
+
}).strict().superRefine((value, context) => {
|
|
6844
|
+
const requiresError = value.outcome === "rejected" || value.outcome === "failed";
|
|
6845
|
+
if (requiresError !== Boolean(value.error)) {
|
|
6846
|
+
context.addIssue({
|
|
6847
|
+
code: "custom",
|
|
6848
|
+
path: ["error"],
|
|
6849
|
+
message: requiresError ? "Rejected and failed command results require an error." : "Accepted and duplicate command results must not contain an error."
|
|
6850
|
+
});
|
|
6851
|
+
}
|
|
6852
|
+
});
|
|
6853
|
+
var AGENT_SESSION_COMMAND_TRANSITIONS = {
|
|
6854
|
+
stop: { queued: "stopping", running: "stopping", waiting_approval: "stopping" },
|
|
6855
|
+
resume: { stopped: "queued", completed: "queued", failed: "queued" },
|
|
6856
|
+
retry: { failed: "queued" },
|
|
6857
|
+
approval: { waiting_approval: "running" }
|
|
6858
|
+
};
|
|
6859
|
+
function resolveAgentSessionCommandTransition(status, commandType) {
|
|
6860
|
+
return AGENT_SESSION_COMMAND_TRANSITIONS[commandType][status];
|
|
6861
|
+
}
|
|
6736
6862
|
var AgentSessionEventHeaderSchema = z3.object({
|
|
6737
6863
|
contract: z3.literal("AgentSessionEvent"),
|
|
6738
6864
|
eventId: ContractIdentifierSchema,
|
|
@@ -6795,7 +6921,7 @@ var AgentSessionEventSchema = z3.discriminatedUnion("eventType", [
|
|
|
6795
6921
|
requestedAction: JsonValueSchema.optional()
|
|
6796
6922
|
}),
|
|
6797
6923
|
sessionEvent("status", {
|
|
6798
|
-
status:
|
|
6924
|
+
status: AgentSessionStatusSchema,
|
|
6799
6925
|
detail: z3.string().optional()
|
|
6800
6926
|
}),
|
|
6801
6927
|
sessionEvent("artifact", {
|
|
@@ -6856,7 +6982,7 @@ var AgentSessionViewModelSchema = z3.object({
|
|
|
6856
6982
|
contract: z3.literal("AgentSessionViewModel"),
|
|
6857
6983
|
sessionId: ContractIdentifierSchema,
|
|
6858
6984
|
snapshot: AgentSessionSnapshotSchema,
|
|
6859
|
-
status:
|
|
6985
|
+
status: AgentSessionStatusSchema,
|
|
6860
6986
|
events: z3.array(AgentSessionEventSchema),
|
|
6861
6987
|
lastSequence: z3.number().int().min(-1),
|
|
6862
6988
|
resumable: z3.boolean().default(false)
|
|
@@ -11357,6 +11483,8 @@ var WorkflowDefinitionSchema = z14.object({
|
|
|
11357
11483
|
|
|
11358
11484
|
// src/schemas/index.ts
|
|
11359
11485
|
var canonicalContractSchemas = {
|
|
11486
|
+
"agent-session-command": AgentSessionCommandSchema,
|
|
11487
|
+
"agent-session-command-result": AgentSessionCommandResultSchema,
|
|
11360
11488
|
"agent-session-event": AgentSessionEventSchema,
|
|
11361
11489
|
"agent-session-view-model": AgentSessionViewModelSchema,
|
|
11362
11490
|
"agent-runtime-event": AgentRuntimeEventSchema,
|
|
@@ -12550,15 +12678,24 @@ var compileWorkflowPersistenceProjection = (input) => {
|
|
|
12550
12678
|
});
|
|
12551
12679
|
};
|
|
12552
12680
|
export {
|
|
12681
|
+
AGENT_MODE_CAPABILITIES,
|
|
12553
12682
|
APPLICATION_HANDOFF_QUERY_PARAMETER,
|
|
12554
12683
|
ActorRefSchema,
|
|
12684
|
+
AgentConfigurationCapabilitySchema,
|
|
12555
12685
|
AgentExecutionModeSchema,
|
|
12686
|
+
AgentModeCapabilitiesSchema,
|
|
12556
12687
|
AgentModeSchema,
|
|
12688
|
+
AgentResourceModeSupportSchema,
|
|
12557
12689
|
AgentRuntimeEventSchema,
|
|
12558
12690
|
AgentSessionCapabilitiesSchema,
|
|
12559
12691
|
AgentSessionCapabilitySchema,
|
|
12692
|
+
AgentSessionCommandErrorCodeSchema,
|
|
12693
|
+
AgentSessionCommandResultSchema,
|
|
12694
|
+
AgentSessionCommandSchema,
|
|
12695
|
+
AgentSessionCommandTypeSchema,
|
|
12560
12696
|
AgentSessionEventSchema,
|
|
12561
12697
|
AgentSessionSnapshotSchema,
|
|
12698
|
+
AgentSessionStatusSchema,
|
|
12562
12699
|
AgentSessionViewModelSchema,
|
|
12563
12700
|
ApplicationHandoffEndpointSchema,
|
|
12564
12701
|
ApplicationHandoffSchema,
|
|
@@ -12693,6 +12830,7 @@ export {
|
|
|
12693
12830
|
WorkflowTriggerSchema,
|
|
12694
12831
|
WorkflowTriggerType,
|
|
12695
12832
|
WorkflowValidationIssueSchema,
|
|
12833
|
+
agentModeHasCapability,
|
|
12696
12834
|
applyViewRuntimeBindings,
|
|
12697
12835
|
assertMonkeysThemeTokensComplete,
|
|
12698
12836
|
assertThemeTokensDocumentStructure,
|
|
@@ -12717,12 +12855,15 @@ export {
|
|
|
12717
12855
|
createToolCapabilityManifest,
|
|
12718
12856
|
createWorkflowCapabilityManifest,
|
|
12719
12857
|
extractOpenApiCapabilityManifests,
|
|
12858
|
+
getAgentModeCapabilities,
|
|
12859
|
+
isAgentResourceModeCompatible,
|
|
12720
12860
|
mergeThemeTokenDocuments,
|
|
12721
12861
|
normalizeAgentExecutionMode,
|
|
12722
12862
|
normalizeAgentMode,
|
|
12723
12863
|
parseApplicationHandoff,
|
|
12724
12864
|
publishOpenApiToolCapabilityManifests,
|
|
12725
12865
|
readApplicationHandoffFromUrl,
|
|
12866
|
+
resolveAgentSessionCommandTransition,
|
|
12726
12867
|
resolveThemeTokens,
|
|
12727
12868
|
serializeApplicationHandoff,
|
|
12728
12869
|
validateDomainCommand,
|