@inf-monkeys-tech/monkeys 1.0.13 → 1.0.15
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 +115 -0
- package/lib/contracts/agent.d.ts.map +1 -1
- package/lib/contracts/agent.js +39 -1
- package/lib/contracts/agent.js.map +1 -1
- package/lib/contracts/tenant.d.ts +30 -30
- package/lib/contracts/tenant.js +8 -8
- package/lib/contracts/tenant.js.map +1 -1
- package/lib/esm/contracts/index.mjs +47 -8
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +142 -8
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +878 -432
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +31 -8
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/tenant-product-config.schema.json +11 -11
- package/lib/json-schema/tenant-runtime-config.schema.json +11 -11
- package/lib/runtime/agent-session-projector.d.ts +17 -0
- package/lib/runtime/agent-session-projector.d.ts.map +1 -0
- package/lib/runtime/agent-session-projector.js +85 -0
- package/lib/runtime/agent-session-projector.js.map +1 -0
- package/lib/runtime/index.d.ts +1 -0
- package/lib/runtime/index.d.ts.map +1 -1
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/schemas/index.d.ts +20 -20
- package/package.json +3 -1
- package/test/fixtures/agent-session-agent.json +134 -0
- package/test/fixtures/agent-session-chatbot.json +73 -0
- package/test/fixtures/agent-session-commands.json +72 -0
- package/test/fixtures/agent-session-kernel.json +131 -0
- package/test/fixtures/tenant-product-config.public.json +179 -0
package/lib/esm/index.mjs
CHANGED
|
@@ -6770,6 +6770,41 @@ var AgentSessionCapabilitiesSchema = z3.object({
|
|
|
6770
6770
|
terminal: z3.boolean().default(false),
|
|
6771
6771
|
testResults: z3.boolean().default(false)
|
|
6772
6772
|
}).strict();
|
|
6773
|
+
var AGENT_SESSION_RUNTIME_CAPABILITIES = Object.freeze({
|
|
6774
|
+
chatbot: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, skills: true, approval: true, usage: true }),
|
|
6775
|
+
agent: AgentSessionCapabilitiesSchema.parse({ text: true, tools: true, mcp: true, shell: true, fileChange: true, skills: true, approval: true, artifacts: true, usage: true, resume: true })
|
|
6776
|
+
});
|
|
6777
|
+
function getAgentSessionRuntimeCapabilities(mode) {
|
|
6778
|
+
return AGENT_SESSION_RUNTIME_CAPABILITIES[mode];
|
|
6779
|
+
}
|
|
6780
|
+
var AGENT_SESSION_CAPABILITY_EVIDENCE = Object.freeze({
|
|
6781
|
+
text: { eventTypes: ["message"], commandTypes: [] },
|
|
6782
|
+
reasoning: { eventTypes: ["reasoning"], commandTypes: [] },
|
|
6783
|
+
plan: { eventTypes: ["plan"], commandTypes: [] },
|
|
6784
|
+
tasks: { eventTypes: ["task"], commandTypes: [] },
|
|
6785
|
+
tools: { eventTypes: ["tool"], commandTypes: [] },
|
|
6786
|
+
mcp: { eventTypes: ["tool"], commandTypes: [] },
|
|
6787
|
+
shell: { eventTypes: ["tool", "terminal"], commandTypes: [] },
|
|
6788
|
+
fileChange: { eventTypes: ["tool", "diff", "workspace-file"], commandTypes: [] },
|
|
6789
|
+
skills: { eventTypes: ["tool"], commandTypes: [] },
|
|
6790
|
+
approval: { eventTypes: ["approval"], commandTypes: ["approval"] },
|
|
6791
|
+
artifacts: { eventTypes: ["artifact"], commandTypes: [] },
|
|
6792
|
+
usage: { eventTypes: ["usage"], commandTypes: [] },
|
|
6793
|
+
resume: { eventTypes: ["resume"], commandTypes: ["resume"] },
|
|
6794
|
+
diff: { eventTypes: ["diff"], commandTypes: [] },
|
|
6795
|
+
workspaceFiles: { eventTypes: ["workspace-file"], commandTypes: [] },
|
|
6796
|
+
terminal: { eventTypes: ["terminal"], commandTypes: [] },
|
|
6797
|
+
testResults: { eventTypes: ["test-result"], commandTypes: [] }
|
|
6798
|
+
});
|
|
6799
|
+
function findUnsupportedAgentSessionCapabilities(capabilities, evidence) {
|
|
6800
|
+
const eventTypes = new Set(evidence.eventTypes || []);
|
|
6801
|
+
const commandTypes = new Set(evidence.commandTypes || []);
|
|
6802
|
+
return AgentSessionCapabilitySchema.options.filter((capability) => {
|
|
6803
|
+
if (!capabilities[capability]) return false;
|
|
6804
|
+
const requirement = AGENT_SESSION_CAPABILITY_EVIDENCE[capability];
|
|
6805
|
+
return !requirement.eventTypes.some((eventType) => eventTypes.has(eventType)) && !requirement.commandTypes.some((commandType) => commandTypes.has(commandType));
|
|
6806
|
+
});
|
|
6807
|
+
}
|
|
6773
6808
|
var AgentSessionSnapshotSchema = z3.object({
|
|
6774
6809
|
mode: AgentModeSchema,
|
|
6775
6810
|
modelId: z3.string().trim().min(1),
|
|
@@ -10715,13 +10750,13 @@ var TenantApplicationConfigSchema = z12.object({
|
|
|
10715
10750
|
rememberWorkflowModelSelection: z12.boolean().optional()
|
|
10716
10751
|
}).strict(),
|
|
10717
10752
|
dataManagement: z12.object({
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10753
|
+
favoriteOntologyId: z12.string().optional(),
|
|
10754
|
+
pairedOntologyId: z12.string().optional(),
|
|
10755
|
+
galleryOntologyId: z12.string().optional(),
|
|
10756
|
+
dataBrowserDefaultOntologyId: z12.string().optional(),
|
|
10757
|
+
workflowResultOntologyId: z12.string().optional(),
|
|
10723
10758
|
homeAdvertisement: z12.object({
|
|
10724
|
-
|
|
10759
|
+
ontologyId: ContractIdentifierSchema,
|
|
10725
10760
|
viewId: ContractIdentifierSchema.optional(),
|
|
10726
10761
|
viewType: z12.enum(["filter", "container", "share_link"]).optional(),
|
|
10727
10762
|
teamId: ContractIdentifierSchema.optional(),
|
|
@@ -10733,7 +10768,7 @@ var TenantApplicationConfigSchema = z12.object({
|
|
|
10733
10768
|
columnIds: z12.record(z12.string(), z12.string()).optional()
|
|
10734
10769
|
}).strict().optional(),
|
|
10735
10770
|
homeTrendAssistant: z12.object({
|
|
10736
|
-
|
|
10771
|
+
ontologyId: ContractIdentifierSchema.optional(),
|
|
10737
10772
|
viewId: ContractIdentifierSchema.optional(),
|
|
10738
10773
|
viewInstanceId: ContractIdentifierSchema.optional(),
|
|
10739
10774
|
viewName: z12.string().optional(),
|
|
@@ -10743,7 +10778,7 @@ var TenantApplicationConfigSchema = z12.object({
|
|
|
10743
10778
|
runtime: z12.object({ appId: ContractIdentifierSchema, tepBaseUrlConfigured: z12.boolean(), tepAuthorizationConfigured: z12.boolean(), tepCookieConfigured: z12.boolean() }).strict().optional()
|
|
10744
10779
|
}).strict().optional(),
|
|
10745
10780
|
sharing: z12.object({
|
|
10746
|
-
silentViewLinks: z12.object({ enabled: z12.boolean().optional(), placement: z12.object({ mode: z12.enum(["
|
|
10781
|
+
silentViewLinks: z12.object({ enabled: z12.boolean().optional(), placement: z12.object({ mode: z12.enum(["sourceOntology", "ontology"]).optional(), ontologyId: ContractIdentifierSchema.optional(), parentId: ContractIdentifierSchema.optional(), navId: ContractIdentifierSchema.optional() }).strict().optional() }).strict().optional(),
|
|
10747
10782
|
shareAccess: z12.object({ publicLinksEnabled: z12.boolean().optional(), passwordGateEnabled: z12.boolean().optional(), passwordAccessTtlSeconds: z12.number().int().positive().optional(), defaultViewTreeDelivery: z12.enum(["manual", "auto"]).optional() }).strict().optional(),
|
|
10748
10783
|
shareDialog: z12.object({
|
|
10749
10784
|
audience: z12.object({ enabled: z12.boolean().optional(), allowed: z12.array(z12.enum(["user", "team", "public"])).optional(), default: z12.enum(["user", "team", "public"]).optional() }).strict().optional(),
|
|
@@ -11670,6 +11705,98 @@ var compileCapabilityRegistry = (sources) => {
|
|
|
11670
11705
|
});
|
|
11671
11706
|
};
|
|
11672
11707
|
|
|
11708
|
+
// src/runtime/agent-session-projector.ts
|
|
11709
|
+
function createAgentSessionEventProjection(sessionId) {
|
|
11710
|
+
return {
|
|
11711
|
+
sessionId,
|
|
11712
|
+
events: [],
|
|
11713
|
+
lastSequence: -1,
|
|
11714
|
+
status: "queued",
|
|
11715
|
+
resumable: false
|
|
11716
|
+
};
|
|
11717
|
+
}
|
|
11718
|
+
function projectAgentSessionEvents(current, candidates) {
|
|
11719
|
+
const parsed = candidates.map(
|
|
11720
|
+
(candidate) => AgentSessionEventSchema.parse(candidate)
|
|
11721
|
+
);
|
|
11722
|
+
if (parsed.some((event) => event.sessionId !== current.sessionId)) {
|
|
11723
|
+
throw new TypeError(
|
|
11724
|
+
"Agent session event sessionId does not match the projection sessionId."
|
|
11725
|
+
);
|
|
11726
|
+
}
|
|
11727
|
+
const eventIds = new Set(current.events.map((event) => event.eventId));
|
|
11728
|
+
const idempotencyKeys = new Set(
|
|
11729
|
+
current.events.map((event) => event.idempotencyKey)
|
|
11730
|
+
);
|
|
11731
|
+
const eventsBySequence = new Map(
|
|
11732
|
+
current.events.map((event) => [event.sequence, event])
|
|
11733
|
+
);
|
|
11734
|
+
const acceptedCandidates = [];
|
|
11735
|
+
for (const event of parsed.sort(
|
|
11736
|
+
(left, right) => left.sequence - right.sequence
|
|
11737
|
+
)) {
|
|
11738
|
+
if (eventIds.has(event.eventId) || idempotencyKeys.has(event.idempotencyKey))
|
|
11739
|
+
continue;
|
|
11740
|
+
const existing = eventsBySequence.get(event.sequence);
|
|
11741
|
+
if (existing) {
|
|
11742
|
+
throw new TypeError(
|
|
11743
|
+
`Conflicting Agent session events share sequence ${event.sequence}.`
|
|
11744
|
+
);
|
|
11745
|
+
}
|
|
11746
|
+
eventsBySequence.set(event.sequence, event);
|
|
11747
|
+
eventIds.add(event.eventId);
|
|
11748
|
+
idempotencyKeys.add(event.idempotencyKey);
|
|
11749
|
+
acceptedCandidates.push(event);
|
|
11750
|
+
}
|
|
11751
|
+
for (const event of acceptedCandidates)
|
|
11752
|
+
eventsBySequence.delete(event.sequence);
|
|
11753
|
+
let expectedSequence = current.lastSequence + 1;
|
|
11754
|
+
let gap;
|
|
11755
|
+
for (const event of acceptedCandidates) {
|
|
11756
|
+
if (event.sequence < expectedSequence) {
|
|
11757
|
+
throw new TypeError(
|
|
11758
|
+
`Agent session event sequence ${event.sequence} is behind the recovery cursor.`
|
|
11759
|
+
);
|
|
11760
|
+
}
|
|
11761
|
+
if (event.sequence > expectedSequence) {
|
|
11762
|
+
gap = { expectedSequence, receivedSequence: event.sequence };
|
|
11763
|
+
break;
|
|
11764
|
+
}
|
|
11765
|
+
eventsBySequence.set(event.sequence, event);
|
|
11766
|
+
eventIds.add(event.eventId);
|
|
11767
|
+
idempotencyKeys.add(event.idempotencyKey);
|
|
11768
|
+
expectedSequence += 1;
|
|
11769
|
+
}
|
|
11770
|
+
const events = [...eventsBySequence.values()].sort(
|
|
11771
|
+
(left, right) => left.sequence - right.sequence
|
|
11772
|
+
);
|
|
11773
|
+
let status = "queued";
|
|
11774
|
+
let resumable = false;
|
|
11775
|
+
for (const event of events) {
|
|
11776
|
+
if (event.eventType === "status") status = event.payload.status;
|
|
11777
|
+
if (event.eventType === "resume") resumable = event.payload.resumable;
|
|
11778
|
+
}
|
|
11779
|
+
return {
|
|
11780
|
+
sessionId: current.sessionId,
|
|
11781
|
+
events,
|
|
11782
|
+
lastSequence: events.length > 0 ? events[events.length - 1].sequence : -1,
|
|
11783
|
+
status,
|
|
11784
|
+
resumable,
|
|
11785
|
+
...gap ? { gap } : {}
|
|
11786
|
+
};
|
|
11787
|
+
}
|
|
11788
|
+
function toAgentSessionViewModel(projection, snapshot) {
|
|
11789
|
+
return AgentSessionViewModelSchema.parse({
|
|
11790
|
+
contract: "AgentSessionViewModel",
|
|
11791
|
+
sessionId: projection.sessionId,
|
|
11792
|
+
snapshot,
|
|
11793
|
+
status: projection.status,
|
|
11794
|
+
events: projection.events,
|
|
11795
|
+
lastSequence: projection.lastSequence,
|
|
11796
|
+
resumable: projection.resumable
|
|
11797
|
+
});
|
|
11798
|
+
}
|
|
11799
|
+
|
|
11673
11800
|
// src/runtime/declaration-compiler.ts
|
|
11674
11801
|
var uniqueIndex = (values, key, label) => {
|
|
11675
11802
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -12679,6 +12806,8 @@ var compileWorkflowPersistenceProjection = (input) => {
|
|
|
12679
12806
|
};
|
|
12680
12807
|
export {
|
|
12681
12808
|
AGENT_MODE_CAPABILITIES,
|
|
12809
|
+
AGENT_SESSION_CAPABILITY_EVIDENCE,
|
|
12810
|
+
AGENT_SESSION_RUNTIME_CAPABILITIES,
|
|
12682
12811
|
APPLICATION_HANDOFF_QUERY_PARAMETER,
|
|
12683
12812
|
ActorRefSchema,
|
|
12684
12813
|
AgentConfigurationCapabilitySchema,
|
|
@@ -12850,22 +12979,27 @@ export {
|
|
|
12850
12979
|
compileViewProviderRegistry,
|
|
12851
12980
|
compileWorkflowDefinitionFromConductor,
|
|
12852
12981
|
compileWorkflowPersistenceProjection,
|
|
12982
|
+
createAgentSessionEventProjection,
|
|
12853
12983
|
createCapabilityRegistrySource,
|
|
12854
12984
|
createOpenApiCapabilityRegistrySource,
|
|
12855
12985
|
createToolCapabilityManifest,
|
|
12856
12986
|
createWorkflowCapabilityManifest,
|
|
12857
12987
|
extractOpenApiCapabilityManifests,
|
|
12988
|
+
findUnsupportedAgentSessionCapabilities,
|
|
12858
12989
|
getAgentModeCapabilities,
|
|
12990
|
+
getAgentSessionRuntimeCapabilities,
|
|
12859
12991
|
isAgentResourceModeCompatible,
|
|
12860
12992
|
mergeThemeTokenDocuments,
|
|
12861
12993
|
normalizeAgentExecutionMode,
|
|
12862
12994
|
normalizeAgentMode,
|
|
12863
12995
|
parseApplicationHandoff,
|
|
12996
|
+
projectAgentSessionEvents,
|
|
12864
12997
|
publishOpenApiToolCapabilityManifests,
|
|
12865
12998
|
readApplicationHandoffFromUrl,
|
|
12866
12999
|
resolveAgentSessionCommandTransition,
|
|
12867
13000
|
resolveThemeTokens,
|
|
12868
13001
|
serializeApplicationHandoff,
|
|
13002
|
+
toAgentSessionViewModel,
|
|
12869
13003
|
validateDomainCommand,
|
|
12870
13004
|
validateThemeTokensDocument,
|
|
12871
13005
|
validateThemeTokensDocumentStructure
|