@pellux/goodvibes-sdk 0.33.38 → 0.34.1
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/dist/contracts/artifacts/operator-contract.json +1383 -4
- package/dist/events/workflows.d.ts +4 -0
- package/dist/events/workflows.d.ts.map +1 -1
- package/dist/platform/agents/message-bus-core.d.ts +11 -0
- package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
- package/dist/platform/agents/message-bus-core.js +28 -21
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +6 -4
- package/dist/platform/agents/wrfc-config.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-config.js +16 -10
- package/dist/platform/agents/wrfc-controller.d.ts +26 -0
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +134 -138
- package/dist/platform/agents/wrfc-runtime-events.d.ts +1 -0
- package/dist/platform/agents/wrfc-runtime-events.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-runtime-events.js +4 -1
- package/dist/platform/automation/delivery-manager.d.ts.map +1 -1
- package/dist/platform/automation/delivery-manager.js +1 -6
- package/dist/platform/batch/manager.d.ts.map +1 -1
- package/dist/platform/batch/manager.js +1 -3
- package/dist/platform/channels/policy-manager.d.ts.map +1 -1
- package/dist/platform/channels/policy-manager.js +1 -3
- package/dist/platform/channels/reply-pipeline.d.ts.map +1 -1
- package/dist/platform/channels/reply-pipeline.js +4 -0
- package/dist/platform/config/schema-domain-core.d.ts +1 -1
- package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-core.js +12 -12
- package/dist/platform/config/schema-domain-runtime.d.ts +1 -1
- package/dist/platform/config/schema-domain-runtime.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-runtime.js +19 -18
- package/dist/platform/config/schema-domain-surfaces.d.ts +1 -1
- package/dist/platform/config/schema-domain-surfaces.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-surfaces.js +4 -3
- package/dist/platform/config/schema-shared.d.ts +6 -0
- package/dist/platform/config/schema-shared.d.ts.map +1 -1
- package/dist/platform/config/schema-shared.js +21 -1
- package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/approval-broker.js +1 -3
- package/dist/platform/control-plane/method-catalog-calendar.d.ts +9 -0
- package/dist/platform/control-plane/method-catalog-calendar.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-calendar.js +117 -0
- package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-channels.js +174 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts +9 -0
- package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-email.js +101 -0
- package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog.js +4 -0
- package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
- package/dist/platform/control-plane/session-broker-state.js +1 -3
- package/dist/platform/core/compaction-sections.d.ts +5 -1
- package/dist/platform/core/compaction-sections.d.ts.map +1 -1
- package/dist/platform/core/compaction-sections.js +73 -66
- package/dist/platform/core/context-compaction.d.ts.map +1 -1
- package/dist/platform/core/context-compaction.js +9 -16
- package/dist/platform/core/orchestrator-context-runtime.d.ts +2 -2
- package/dist/platform/core/orchestrator-context-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-context-runtime.js +24 -21
- package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-tool-runtime.js +2 -1
- package/dist/platform/core/session-lineage.d.ts +2 -5
- package/dist/platform/core/session-lineage.d.ts.map +1 -1
- package/dist/platform/core/session-lineage.js +4 -16
- package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
- package/dist/platform/core/wrfc-routing.js +1 -3
- package/dist/platform/daemon/http/mcp-routes.d.ts.map +1 -1
- package/dist/platform/daemon/http/mcp-routes.js +1 -3
- package/dist/platform/daemon/http/openai-compatible-routes.d.ts.map +1 -1
- package/dist/platform/daemon/http/openai-compatible-routes.js +1 -3
- package/dist/platform/daemon/http/runtime-routes.d.ts.map +1 -1
- package/dist/platform/daemon/http/runtime-routes.js +1 -3
- package/dist/platform/hooks/runners/http.d.ts.map +1 -1
- package/dist/platform/hooks/runners/http.js +9 -19
- package/dist/platform/integrations/webhooks.js +2 -11
- package/dist/platform/knowledge/semantic/self-improvement.d.ts.map +1 -1
- package/dist/platform/knowledge/semantic/self-improvement.js +2 -21
- package/dist/platform/mcp/client.d.ts.map +1 -1
- package/dist/platform/mcp/client.js +1 -3
- package/dist/platform/mcp/config.d.ts.map +1 -1
- package/dist/platform/mcp/config.js +1 -3
- package/dist/platform/media/builtin-generation-providers.d.ts.map +1 -1
- package/dist/platform/media/builtin-generation-providers.js +1 -6
- package/dist/platform/providers/anthropic-compat.d.ts.map +1 -1
- package/dist/platform/providers/anthropic-compat.js +11 -131
- package/dist/platform/providers/anthropic-sdk-provider.d.ts.map +1 -1
- package/dist/platform/providers/anthropic-sdk-provider.js +8 -42
- package/dist/platform/providers/anthropic-sse-assembler.d.ts +80 -0
- package/dist/platform/providers/anthropic-sse-assembler.d.ts.map +1 -0
- package/dist/platform/providers/anthropic-sse-assembler.js +146 -0
- package/dist/platform/providers/anthropic-stream.d.ts +30 -0
- package/dist/platform/providers/anthropic-stream.d.ts.map +1 -0
- package/dist/platform/providers/anthropic-stream.js +44 -0
- package/dist/platform/providers/anthropic-vertex.d.ts.map +1 -1
- package/dist/platform/providers/anthropic-vertex.js +1 -3
- package/dist/platform/providers/anthropic.d.ts.map +1 -1
- package/dist/platform/providers/anthropic.js +15 -151
- package/dist/platform/providers/capabilities.d.ts.map +1 -1
- package/dist/platform/providers/capabilities.js +11 -7
- package/dist/platform/providers/context-discovery.d.ts.map +1 -1
- package/dist/platform/providers/context-discovery.js +9 -16
- package/dist/platform/providers/context-window-fallback.d.ts +24 -0
- package/dist/platform/providers/context-window-fallback.d.ts.map +1 -0
- package/dist/platform/providers/context-window-fallback.js +48 -0
- package/dist/platform/providers/gemini.d.ts.map +1 -1
- package/dist/platform/providers/gemini.js +3 -6
- package/dist/platform/providers/json-ttl-cache.d.ts +35 -0
- package/dist/platform/providers/json-ttl-cache.d.ts.map +1 -0
- package/dist/platform/providers/json-ttl-cache.js +52 -0
- package/dist/platform/providers/llama-cpp.d.ts.map +1 -1
- package/dist/platform/providers/llama-cpp.js +2 -23
- package/dist/platform/providers/lm-studio-helpers.d.ts +1 -1
- package/dist/platform/providers/lm-studio-helpers.d.ts.map +1 -1
- package/dist/platform/providers/lm-studio-helpers.js +5 -25
- package/dist/platform/providers/model-benchmarks.d.ts.map +1 -1
- package/dist/platform/providers/model-benchmarks.js +11 -34
- package/dist/platform/providers/model-catalog-cache.d.ts.map +1 -1
- package/dist/platform/providers/model-catalog-cache.js +15 -38
- package/dist/platform/providers/model-catalog-synthetic.d.ts.map +1 -1
- package/dist/platform/providers/model-catalog-synthetic.js +3 -2
- package/dist/platform/providers/model-catalog.d.ts.map +1 -1
- package/dist/platform/providers/model-catalog.js +3 -2
- package/dist/platform/providers/model-limits.d.ts.map +1 -1
- package/dist/platform/providers/model-limits.js +18 -42
- package/dist/platform/providers/ollama.d.ts.map +1 -1
- package/dist/platform/providers/ollama.js +3 -24
- package/dist/platform/providers/openai-codex.d.ts.map +1 -1
- package/dist/platform/providers/openai-codex.js +8 -9
- package/dist/platform/providers/openai-compat.d.ts.map +1 -1
- package/dist/platform/providers/openai-compat.js +13 -40
- package/dist/platform/providers/openai-stream-helpers.d.ts +62 -0
- package/dist/platform/providers/openai-stream-helpers.d.ts.map +1 -0
- package/dist/platform/providers/openai-stream-helpers.js +73 -0
- package/dist/platform/providers/openai.d.ts.map +1 -1
- package/dist/platform/providers/openai.js +13 -41
- package/dist/platform/providers/provider-error.d.ts +17 -0
- package/dist/platform/providers/provider-error.d.ts.map +1 -0
- package/dist/platform/providers/provider-error.js +33 -0
- package/dist/platform/providers/provider-stop-reason.d.ts +15 -0
- package/dist/platform/providers/provider-stop-reason.d.ts.map +1 -0
- package/dist/platform/providers/provider-stop-reason.js +15 -0
- package/dist/platform/providers/sse-line-buffer.d.ts +13 -0
- package/dist/platform/providers/sse-line-buffer.d.ts.map +1 -0
- package/dist/platform/providers/sse-line-buffer.js +23 -0
- package/dist/platform/providers/tool-formats.d.ts +5 -0
- package/dist/platform/providers/tool-formats.d.ts.map +1 -1
- package/dist/platform/providers/tool-formats.js +14 -0
- package/dist/platform/runtime/bootstrap-runtime-events.d.ts.map +1 -1
- package/dist/platform/runtime/bootstrap-runtime-events.js +6 -0
- package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
- package/dist/platform/runtime/bootstrap-services.js +4 -5
- package/dist/platform/runtime/emitters/workflows.d.ts +4 -0
- package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/workflows.js +3 -0
- package/dist/platform/runtime/remote/distributed-runtime-store.d.ts.map +1 -1
- package/dist/platform/runtime/remote/distributed-runtime-store.js +1 -3
- package/dist/platform/runtime/retention/pruner.js +2 -5
- package/dist/platform/runtime/store/helpers/reducers/lifecycle.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/lifecycle.js +15 -14
- package/dist/platform/runtime/store/helpers/reducers/shared.d.ts +6 -0
- package/dist/platform/runtime/store/helpers/reducers/shared.d.ts.map +1 -1
- package/dist/platform/runtime/store/helpers/reducers/shared.js +8 -1
- package/dist/platform/runtime/telemetry/exporters/queue.d.ts.map +1 -1
- package/dist/platform/runtime/telemetry/exporters/queue.js +1 -7
- package/dist/platform/runtime/transports/http-helpers.d.ts +0 -1
- package/dist/platform/runtime/transports/http-helpers.d.ts.map +1 -1
- package/dist/platform/runtime/transports/http-helpers.js +1 -3
- package/dist/platform/runtime/ui-read-model-helpers.d.ts +2 -0
- package/dist/platform/runtime/ui-read-model-helpers.d.ts.map +1 -1
- package/dist/platform/runtime/ui-read-model-helpers.js +8 -0
- package/dist/platform/runtime/ui-read-models-core.d.ts.map +1 -1
- package/dist/platform/runtime/ui-read-models-core.js +3 -5
- package/dist/platform/runtime/ui-read-models-observability-remote.d.ts.map +1 -1
- package/dist/platform/runtime/ui-read-models-observability-remote.js +2 -4
- package/dist/platform/runtime/ui-read-models-operations.d.ts.map +1 -1
- package/dist/platform/runtime/ui-read-models-operations.js +8 -26
- package/dist/platform/scheduler/scheduler.d.ts.map +1 -1
- package/dist/platform/scheduler/scheduler.js +1 -3
- package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/platform/tools/exec/runtime.js +1 -7
- package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
- package/dist/platform/tools/fetch/runtime.js +9 -20
- package/dist/platform/tools/shared/process-manager.d.ts.map +1 -1
- package/dist/platform/tools/shared/process-manager.js +1 -6
- package/dist/platform/utils/concurrency.d.ts +1 -0
- package/dist/platform/utils/concurrency.d.ts.map +1 -1
- package/dist/platform/utils/concurrency.js +1 -0
- package/dist/platform/utils/error-display.d.ts +9 -0
- package/dist/platform/utils/error-display.d.ts.map +1 -1
- package/dist/platform/utils/error-display.js +11 -0
- package/dist/platform/utils/fetch-with-timeout.d.ts +22 -2
- package/dist/platform/utils/fetch-with-timeout.d.ts.map +1 -1
- package/dist/platform/utils/fetch-with-timeout.js +33 -15
- package/dist/platform/utils/record-coerce.d.ts +5 -0
- package/dist/platform/utils/record-coerce.d.ts.map +1 -1
- package/dist/platform/utils/record-coerce.js +7 -0
- package/dist/platform/utils/retry.d.ts.map +1 -1
- package/dist/platform/utils/retry.js +2 -4
- package/dist/platform/version.js +1 -1
- package/package.json +9 -9
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
import { EMPTY_OBJECT_SCHEMA, STRING_SCHEMA, BOOLEAN_SCHEMA, NUMBER_SCHEMA, arraySchema, objectSchema, listOutputSchema, bodyEnvelopeSchema, methodDescriptor, runtimeEventId } from './method-catalog-shared.js';
|
|
2
2
|
import { HTTP_HEADER_MAP_SCHEMA, METADATA_SCHEMA, } from './operator-contract-schemas-shared.js';
|
|
3
3
|
import { CHANNEL_ACCOUNT_ACTION_OUTPUT_SCHEMA, CHANNEL_ACCOUNTS_OUTPUT_SCHEMA, CHANNEL_ACCOUNT_ENTITY_OUTPUT_SCHEMA, CHANNEL_ALLOWLIST_EDIT_RESULT_SCHEMA, CHANNEL_ALLOWLIST_RESOLUTION_SCHEMA, CHANNEL_AUTHORIZE_OUTPUT_SCHEMA, CHANNEL_CAPABILITY_SCHEMA, CHANNEL_DOCTOR_REPORT_SCHEMA, CHANNEL_DIRECTORY_ENTRY_SCHEMA, CHANNEL_GROUP_POLICY_SCHEMA, CHANNEL_LIFECYCLE_STATE_SCHEMA, CHANNEL_OPERATOR_ACTION_OUTPUT_SCHEMA, CHANNEL_OPERATOR_ACTION_SCHEMA, CHANNEL_POLICY_AUDIT_SCHEMA, CHANNEL_POLICY_SCHEMA, CHANNEL_SETUP_SCHEMA_SCHEMA, CHANNEL_STATUS_LIST_OUTPUT_SCHEMA, CHANNEL_TARGET_RESOLVE_OUTPUT_SCHEMA, CHANNEL_TOOL_SCHEMA, CHANNEL_TOOL_ACTION_OUTPUT_SCHEMA, CHANNEL_REPAIR_ACTION_SCHEMA, TOOL_DEFINITION_SCHEMA, REMOVE_WITH_ID_OUTPUT_SCHEMA, SERVICE_STATUS_SCHEMA, WATCHER_LIST_OUTPUT_SCHEMA, WATCHER_RECORD_SCHEMA, } from './operator-contract-schemas.js';
|
|
4
|
+
const CHANNEL_INBOX_ITEM_SCHEMA = objectSchema({
|
|
5
|
+
id: STRING_SCHEMA,
|
|
6
|
+
provider: STRING_SCHEMA,
|
|
7
|
+
kind: STRING_SCHEMA,
|
|
8
|
+
from: STRING_SCHEMA,
|
|
9
|
+
fromAddress: STRING_SCHEMA,
|
|
10
|
+
subject: STRING_SCHEMA,
|
|
11
|
+
bodyPreview: STRING_SCHEMA,
|
|
12
|
+
receivedAt: NUMBER_SCHEMA,
|
|
13
|
+
unread: BOOLEAN_SCHEMA,
|
|
14
|
+
routeId: STRING_SCHEMA,
|
|
15
|
+
threadId: STRING_SCHEMA,
|
|
16
|
+
attachmentCount: NUMBER_SCHEMA,
|
|
17
|
+
}, ['id', 'provider', 'kind', 'from', 'bodyPreview', 'receivedAt', 'unread']);
|
|
18
|
+
const CHANNEL_ROUTING_RULE_SCHEMA = objectSchema({
|
|
19
|
+
id: STRING_SCHEMA,
|
|
20
|
+
createdAt: STRING_SCHEMA,
|
|
21
|
+
updatedAt: STRING_SCHEMA,
|
|
22
|
+
surfaceKind: STRING_SCHEMA,
|
|
23
|
+
routeId: STRING_SCHEMA,
|
|
24
|
+
profileId: STRING_SCHEMA,
|
|
25
|
+
label: STRING_SCHEMA,
|
|
26
|
+
}, ['id', 'createdAt', 'updatedAt', 'surfaceKind', 'profileId']);
|
|
27
|
+
const CHANNEL_DRAFT_PROPERTIES = {
|
|
28
|
+
version: NUMBER_SCHEMA,
|
|
29
|
+
id: STRING_SCHEMA,
|
|
30
|
+
createdAt: STRING_SCHEMA,
|
|
31
|
+
updatedAt: STRING_SCHEMA,
|
|
32
|
+
status: STRING_SCHEMA,
|
|
33
|
+
title: STRING_SCHEMA,
|
|
34
|
+
message: STRING_SCHEMA,
|
|
35
|
+
channel: STRING_SCHEMA,
|
|
36
|
+
route: STRING_SCHEMA,
|
|
37
|
+
webhook: STRING_SCHEMA,
|
|
38
|
+
link: STRING_SCHEMA,
|
|
39
|
+
tags: arraySchema(STRING_SCHEMA),
|
|
40
|
+
sentResponseId: STRING_SCHEMA,
|
|
41
|
+
sendError: STRING_SCHEMA,
|
|
42
|
+
};
|
|
43
|
+
const CHANNEL_DRAFT_REQUIRED = ['version', 'id', 'createdAt', 'updatedAt', 'status', 'message'];
|
|
44
|
+
const CHANNEL_DRAFT_SCHEMA = objectSchema({ ...CHANNEL_DRAFT_PROPERTIES }, [...CHANNEL_DRAFT_REQUIRED]);
|
|
45
|
+
const CHANNEL_DRAFT_GET_OUTPUT_SCHEMA = objectSchema({ ...CHANNEL_DRAFT_PROPERTIES, notFound: BOOLEAN_SCHEMA }, [], { additionalProperties: true });
|
|
4
46
|
export const builtinGatewayChannelMethodDescriptors = [
|
|
5
47
|
methodDescriptor({
|
|
6
48
|
id: 'channels.accounts.list',
|
|
@@ -542,4 +584,136 @@ export const builtinGatewayChannelMethodDescriptors = [
|
|
|
542
584
|
outputSchema: SERVICE_STATUS_SCHEMA,
|
|
543
585
|
dangerous: true,
|
|
544
586
|
}),
|
|
587
|
+
methodDescriptor({
|
|
588
|
+
id: 'channels.inbox.list',
|
|
589
|
+
title: 'List Channel Inbox',
|
|
590
|
+
description: 'Return per-provider inbound message feeds (Slack DMs, Discord messages, email threads) fetched live from provider APIs. Read-only; no provider write.',
|
|
591
|
+
category: 'channels',
|
|
592
|
+
scopes: ['read:channels'],
|
|
593
|
+
http: { method: 'GET', path: '/api/channels/inbox' },
|
|
594
|
+
inputSchema: objectSchema({
|
|
595
|
+
provider: STRING_SCHEMA,
|
|
596
|
+
limit: NUMBER_SCHEMA,
|
|
597
|
+
since: NUMBER_SCHEMA,
|
|
598
|
+
}),
|
|
599
|
+
outputSchema: objectSchema({
|
|
600
|
+
items: arraySchema(CHANNEL_INBOX_ITEM_SCHEMA),
|
|
601
|
+
total: NUMBER_SCHEMA,
|
|
602
|
+
truncated: BOOLEAN_SCHEMA,
|
|
603
|
+
cursor: STRING_SCHEMA,
|
|
604
|
+
}, ['items', 'total', 'truncated']),
|
|
605
|
+
}),
|
|
606
|
+
methodDescriptor({
|
|
607
|
+
id: 'channels.routing.list',
|
|
608
|
+
title: 'List Channel Routing Rules',
|
|
609
|
+
description: 'Return the daemon-persisted channel-to-profile routing table.',
|
|
610
|
+
category: 'channels',
|
|
611
|
+
scopes: ['read:channels'],
|
|
612
|
+
http: { method: 'GET', path: '/api/channels/routing' },
|
|
613
|
+
inputSchema: objectSchema({
|
|
614
|
+
profileId: STRING_SCHEMA,
|
|
615
|
+
surfaceKind: STRING_SCHEMA,
|
|
616
|
+
limit: NUMBER_SCHEMA,
|
|
617
|
+
}),
|
|
618
|
+
outputSchema: objectSchema({
|
|
619
|
+
routes: arraySchema(CHANNEL_ROUTING_RULE_SCHEMA),
|
|
620
|
+
total: NUMBER_SCHEMA,
|
|
621
|
+
}, ['routes', 'total']),
|
|
622
|
+
}),
|
|
623
|
+
methodDescriptor({
|
|
624
|
+
id: 'channels.routing.assign',
|
|
625
|
+
title: 'Assign Channel Routing Rule',
|
|
626
|
+
description: 'Create or update a channel-to-profile routing rule in the daemon-persisted routing table. Requires explicit confirmation.',
|
|
627
|
+
category: 'channels',
|
|
628
|
+
scopes: ['write:channels'],
|
|
629
|
+
access: 'admin',
|
|
630
|
+
http: { method: 'POST', path: '/api/channels/routing' },
|
|
631
|
+
inputSchema: bodyEnvelopeSchema({
|
|
632
|
+
channelId: STRING_SCHEMA,
|
|
633
|
+
surfaceKind: STRING_SCHEMA,
|
|
634
|
+
routeId: STRING_SCHEMA,
|
|
635
|
+
profileId: STRING_SCHEMA,
|
|
636
|
+
label: STRING_SCHEMA,
|
|
637
|
+
}, ['surfaceKind', 'profileId']),
|
|
638
|
+
outputSchema: objectSchema({
|
|
639
|
+
assignmentId: STRING_SCHEMA,
|
|
640
|
+
channelId: STRING_SCHEMA,
|
|
641
|
+
surfaceKind: STRING_SCHEMA,
|
|
642
|
+
routeId: STRING_SCHEMA,
|
|
643
|
+
profileId: STRING_SCHEMA,
|
|
644
|
+
label: STRING_SCHEMA,
|
|
645
|
+
createdAt: STRING_SCHEMA,
|
|
646
|
+
updatedAt: STRING_SCHEMA,
|
|
647
|
+
}, ['assignmentId', 'surfaceKind', 'profileId', 'createdAt', 'updatedAt']),
|
|
648
|
+
}),
|
|
649
|
+
methodDescriptor({
|
|
650
|
+
id: 'channels.routing.delete',
|
|
651
|
+
title: 'Delete Channel Routing Rule',
|
|
652
|
+
description: 'Remove a channel-to-profile routing rule from the daemon-persisted routing table.',
|
|
653
|
+
category: 'channels',
|
|
654
|
+
scopes: ['write:channels'],
|
|
655
|
+
access: 'admin',
|
|
656
|
+
http: { method: 'DELETE', path: '/api/channels/routing/{assignmentId}' },
|
|
657
|
+
inputSchema: objectSchema({ assignmentId: STRING_SCHEMA }, ['assignmentId']),
|
|
658
|
+
outputSchema: objectSchema({
|
|
659
|
+
deleted: BOOLEAN_SCHEMA,
|
|
660
|
+
assignmentId: STRING_SCHEMA,
|
|
661
|
+
}, ['deleted', 'assignmentId']),
|
|
662
|
+
dangerous: true,
|
|
663
|
+
}),
|
|
664
|
+
methodDescriptor({
|
|
665
|
+
id: 'channels.drafts.list',
|
|
666
|
+
title: 'List Channel Drafts',
|
|
667
|
+
description: 'Return daemon-mirrored channel drafts for cross-device sync. Webhook values are stored redacted.',
|
|
668
|
+
category: 'channels',
|
|
669
|
+
scopes: ['read:channels'],
|
|
670
|
+
http: { method: 'GET', path: '/api/channels/drafts' },
|
|
671
|
+
inputSchema: objectSchema({
|
|
672
|
+
status: STRING_SCHEMA,
|
|
673
|
+
limit: NUMBER_SCHEMA,
|
|
674
|
+
}),
|
|
675
|
+
outputSchema: objectSchema({
|
|
676
|
+
drafts: arraySchema(CHANNEL_DRAFT_SCHEMA),
|
|
677
|
+
total: NUMBER_SCHEMA,
|
|
678
|
+
}, ['drafts', 'total']),
|
|
679
|
+
}),
|
|
680
|
+
methodDescriptor({
|
|
681
|
+
id: 'channels.drafts.get',
|
|
682
|
+
title: 'Get Channel Draft',
|
|
683
|
+
description: 'Return a single daemon-mirrored channel draft by id, or a notFound marker.',
|
|
684
|
+
category: 'channels',
|
|
685
|
+
scopes: ['read:channels'],
|
|
686
|
+
http: { method: 'GET', path: '/api/channels/drafts/{draftId}' },
|
|
687
|
+
inputSchema: objectSchema({ draftId: STRING_SCHEMA }, ['draftId']),
|
|
688
|
+
outputSchema: CHANNEL_DRAFT_GET_OUTPUT_SCHEMA,
|
|
689
|
+
}),
|
|
690
|
+
methodDescriptor({
|
|
691
|
+
id: 'channels.drafts.save',
|
|
692
|
+
title: 'Save Channel Draft',
|
|
693
|
+
description: 'Mirror a channel draft to the daemon-side store. Webhook values must be redacted before transmission; raw webhook tokens are rejected. Requires explicit confirmation.',
|
|
694
|
+
category: 'channels',
|
|
695
|
+
scopes: ['write:channels'],
|
|
696
|
+
access: 'admin',
|
|
697
|
+
http: { method: 'POST', path: '/api/channels/drafts' },
|
|
698
|
+
inputSchema: bodyEnvelopeSchema({ ...CHANNEL_DRAFT_PROPERTIES }, [...CHANNEL_DRAFT_REQUIRED]),
|
|
699
|
+
outputSchema: objectSchema({
|
|
700
|
+
draft: CHANNEL_DRAFT_SCHEMA,
|
|
701
|
+
created: BOOLEAN_SCHEMA,
|
|
702
|
+
}, ['draft', 'created']),
|
|
703
|
+
}),
|
|
704
|
+
methodDescriptor({
|
|
705
|
+
id: 'channels.drafts.delete',
|
|
706
|
+
title: 'Delete Channel Draft',
|
|
707
|
+
description: 'Remove a channel draft from the daemon-side store.',
|
|
708
|
+
category: 'channels',
|
|
709
|
+
scopes: ['write:channels'],
|
|
710
|
+
access: 'admin',
|
|
711
|
+
http: { method: 'DELETE', path: '/api/channels/drafts/{draftId}' },
|
|
712
|
+
inputSchema: objectSchema({ draftId: STRING_SCHEMA }, ['draftId']),
|
|
713
|
+
outputSchema: objectSchema({
|
|
714
|
+
deleted: BOOLEAN_SCHEMA,
|
|
715
|
+
draftId: STRING_SCHEMA,
|
|
716
|
+
}, ['deleted', 'draftId']),
|
|
717
|
+
dangerous: true,
|
|
718
|
+
}),
|
|
545
719
|
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GatewayMethodDescriptor } from './method-catalog-shared.js';
|
|
2
|
+
/**
|
|
3
|
+
* Email operator methods — exposes the agent's IMAP/SMTP capabilities through the
|
|
4
|
+
* standard operator method protocol so email operations can be triggered via MCP
|
|
5
|
+
* connector actions in addition to the direct-socket path. Daemon-backed; the SDK
|
|
6
|
+
* publishes the typed contract surface (no internal handler).
|
|
7
|
+
*/
|
|
8
|
+
export declare const builtinGatewayEmailMethodDescriptors: readonly GatewayMethodDescriptor[];
|
|
9
|
+
//# sourceMappingURL=method-catalog-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method-catalog-email.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/method-catalog-email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAsC1E;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,EAAE,SAAS,uBAAuB,EAyElF,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { STRING_SCHEMA, BOOLEAN_SCHEMA, NUMBER_SCHEMA, arraySchema, objectSchema, bodyEnvelopeSchema, methodDescriptor, } from './method-catalog-shared.js';
|
|
2
|
+
const EMAIL_INBOX_MESSAGE_SCHEMA = objectSchema({
|
|
3
|
+
uid: NUMBER_SCHEMA,
|
|
4
|
+
from: STRING_SCHEMA,
|
|
5
|
+
subject: STRING_SCHEMA,
|
|
6
|
+
date: STRING_SCHEMA,
|
|
7
|
+
unread: BOOLEAN_SCHEMA,
|
|
8
|
+
bodyPreview: STRING_SCHEMA,
|
|
9
|
+
messageId: STRING_SCHEMA,
|
|
10
|
+
}, ['uid', 'from', 'subject', 'date', 'unread', 'bodyPreview', 'messageId']);
|
|
11
|
+
const EMAIL_ATTACHMENT_SCHEMA = objectSchema({
|
|
12
|
+
filename: STRING_SCHEMA,
|
|
13
|
+
contentType: STRING_SCHEMA,
|
|
14
|
+
sizeBytes: NUMBER_SCHEMA,
|
|
15
|
+
}, ['filename', 'contentType', 'sizeBytes']);
|
|
16
|
+
const EMAIL_MESSAGE_DETAIL_SCHEMA = objectSchema({
|
|
17
|
+
uid: NUMBER_SCHEMA,
|
|
18
|
+
from: STRING_SCHEMA,
|
|
19
|
+
subject: STRING_SCHEMA,
|
|
20
|
+
date: STRING_SCHEMA,
|
|
21
|
+
messageId: STRING_SCHEMA,
|
|
22
|
+
bodyText: STRING_SCHEMA,
|
|
23
|
+
bodyHtml: STRING_SCHEMA,
|
|
24
|
+
attachments: arraySchema(EMAIL_ATTACHMENT_SCHEMA),
|
|
25
|
+
}, ['uid', 'from', 'subject', 'date', 'messageId', 'bodyText']);
|
|
26
|
+
/**
|
|
27
|
+
* Email operator methods — exposes the agent's IMAP/SMTP capabilities through the
|
|
28
|
+
* standard operator method protocol so email operations can be triggered via MCP
|
|
29
|
+
* connector actions in addition to the direct-socket path. Daemon-backed; the SDK
|
|
30
|
+
* publishes the typed contract surface (no internal handler).
|
|
31
|
+
*/
|
|
32
|
+
export const builtinGatewayEmailMethodDescriptors = [
|
|
33
|
+
methodDescriptor({
|
|
34
|
+
id: 'email.inbox.list',
|
|
35
|
+
title: 'List Email Inbox',
|
|
36
|
+
description: 'Return inbox message summaries fetched live from the configured IMAP account. Read-only (EXAMINE / BODY.PEEK); never marks messages read.',
|
|
37
|
+
category: 'email',
|
|
38
|
+
scopes: ['read:email'],
|
|
39
|
+
http: { method: 'GET', path: '/api/email/inbox' },
|
|
40
|
+
inputSchema: objectSchema({
|
|
41
|
+
limit: NUMBER_SCHEMA,
|
|
42
|
+
since: STRING_SCHEMA,
|
|
43
|
+
unreadOnly: BOOLEAN_SCHEMA,
|
|
44
|
+
}),
|
|
45
|
+
outputSchema: objectSchema({
|
|
46
|
+
messages: arraySchema(EMAIL_INBOX_MESSAGE_SCHEMA),
|
|
47
|
+
total: NUMBER_SCHEMA,
|
|
48
|
+
}, ['messages', 'total']),
|
|
49
|
+
}),
|
|
50
|
+
methodDescriptor({
|
|
51
|
+
id: 'email.inbox.read',
|
|
52
|
+
title: 'Read Email Message',
|
|
53
|
+
description: 'Return the full body and attachment metadata for a single inbox message by IMAP UID. Read-only (BODY.PEEK; does not mark as read).',
|
|
54
|
+
category: 'email',
|
|
55
|
+
scopes: ['read:email'],
|
|
56
|
+
http: { method: 'GET', path: '/api/email/inbox/{uid}' },
|
|
57
|
+
inputSchema: objectSchema({ uid: NUMBER_SCHEMA }, ['uid']),
|
|
58
|
+
outputSchema: EMAIL_MESSAGE_DETAIL_SCHEMA,
|
|
59
|
+
}),
|
|
60
|
+
methodDescriptor({
|
|
61
|
+
id: 'email.draft.create',
|
|
62
|
+
title: 'Create Email Draft',
|
|
63
|
+
description: 'Append a draft message to the configured IMAP Drafts folder. Distinct from the local channel draft store. Requires explicit confirmation.',
|
|
64
|
+
category: 'email',
|
|
65
|
+
scopes: ['write:email'],
|
|
66
|
+
access: 'admin',
|
|
67
|
+
http: { method: 'POST', path: '/api/email/drafts' },
|
|
68
|
+
inputSchema: bodyEnvelopeSchema({
|
|
69
|
+
to: STRING_SCHEMA,
|
|
70
|
+
subject: STRING_SCHEMA,
|
|
71
|
+
body: STRING_SCHEMA,
|
|
72
|
+
inReplyTo: STRING_SCHEMA,
|
|
73
|
+
references: STRING_SCHEMA,
|
|
74
|
+
}, ['to', 'subject', 'body']),
|
|
75
|
+
outputSchema: objectSchema({
|
|
76
|
+
uid: NUMBER_SCHEMA,
|
|
77
|
+
draftId: STRING_SCHEMA,
|
|
78
|
+
}, ['uid', 'draftId']),
|
|
79
|
+
}),
|
|
80
|
+
methodDescriptor({
|
|
81
|
+
id: 'email.send',
|
|
82
|
+
title: 'Send Email',
|
|
83
|
+
description: 'Send a composed email via the configured SMTP account. Irreversible external send; requires confirm: true and explicit user review of recipients and body.',
|
|
84
|
+
category: 'email',
|
|
85
|
+
scopes: ['write:email'],
|
|
86
|
+
access: 'admin',
|
|
87
|
+
http: { method: 'POST', path: '/api/email/send' },
|
|
88
|
+
inputSchema: bodyEnvelopeSchema({
|
|
89
|
+
to: STRING_SCHEMA,
|
|
90
|
+
subject: STRING_SCHEMA,
|
|
91
|
+
body: STRING_SCHEMA,
|
|
92
|
+
inReplyTo: STRING_SCHEMA,
|
|
93
|
+
confirm: BOOLEAN_SCHEMA,
|
|
94
|
+
}, ['to', 'subject', 'body', 'confirm']),
|
|
95
|
+
outputSchema: objectSchema({
|
|
96
|
+
messageId: STRING_SCHEMA,
|
|
97
|
+
sentAt: STRING_SCHEMA,
|
|
98
|
+
}, ['messageId', 'sentAt']),
|
|
99
|
+
dangerous: true,
|
|
100
|
+
}),
|
|
101
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-catalog.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/method-catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"method-catalog.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/method-catalog.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAKpC,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AA6DpC,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IACtE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;gBAExD,OAAO,GAAE;QAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAO;IAWhE,QAAQ,CACN,UAAU,EAAE,uBAAuB,EACnC,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,GAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAC3C,MAAM,IAAI;IAcb,aAAa,CACX,UAAU,EAAE,sBAAsB,EAClC,OAAO,GAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAC3C,MAAM,IAAI;IAcb,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI/B,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIpC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAa1C,IAAI,CAAC,OAAO,GAAE,wBAA6B,GAAG,uBAAuB,EAAE;IASvE,UAAU,CAAC,OAAO,GAAE,uBAA4B,GAAG,sBAAsB,EAAE;IAU3E,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI;IAI/C,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI;IAInD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI/B,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI;IAUnF,YAAY,CAAC,OAAO,GAAE;QAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,MAAM,EAAE;IAiBnE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;CAMhF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { builtinGatewayAdminMethodDescriptors, } from './method-catalog-admin.js';
|
|
2
2
|
import { builtinGatewayChannelMethodDescriptors, } from './method-catalog-channels.js';
|
|
3
3
|
import { builtinGatewayControlMethodDescriptors, } from './method-catalog-control.js';
|
|
4
|
+
import { builtinGatewayEmailMethodDescriptors, } from './method-catalog-email.js';
|
|
5
|
+
import { builtinGatewayCalendarMethodDescriptors, } from './method-catalog-calendar.js';
|
|
4
6
|
import { builtinGatewayEventDescriptors, } from './method-catalog-events.js';
|
|
5
7
|
import { builtinGatewayKnowledgeMethodDescriptors, } from './method-catalog-knowledge.js';
|
|
6
8
|
import { builtinGatewayMediaMethodDescriptors, } from './method-catalog-media.js';
|
|
@@ -9,6 +11,8 @@ const BUILTIN_GATEWAY_EVENTS = builtinGatewayEventDescriptors;
|
|
|
9
11
|
const BUILTIN_GATEWAY_METHODS = [
|
|
10
12
|
...builtinGatewayControlMethodDescriptors,
|
|
11
13
|
...builtinGatewayChannelMethodDescriptors,
|
|
14
|
+
...builtinGatewayEmailMethodDescriptors,
|
|
15
|
+
...builtinGatewayCalendarMethodDescriptors,
|
|
12
16
|
...builtinGatewayRuntimeMethodDescriptors,
|
|
13
17
|
...builtinGatewayKnowledgeMethodDescriptors,
|
|
14
18
|
...builtinGatewayMediaMethodDescriptors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-broker-state.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-broker-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"session-broker-state.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/session-broker-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAyQ9G,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,EAAE,CAE1F;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,EAAE,CAE5F;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,EAAE,CAElG;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GAAG;IAC/F,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACpD,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IACvD,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC;CAC1D,CAsCA;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE;IACL,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC5D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC,CAAC;IACxE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,wBAAwB,EAAE,CAAC,CAAC;CAC3E,EACD,oBAAoB,EAAE,MAAM,GAC3B,0BAA0B,CAQ5B;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,SAAS,wBAAwB,EAAE,EACjD,WAAW,EAAE,wBAAwB,GACpC,wBAAwB,EAAE,CAM5B;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,GAAG,MAAM,CAI9F"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SHARED_SESSION_INPUT_INTENTS, SHARED_SESSION_INPUT_STATES, } from './session-intents.js';
|
|
2
|
+
import { isRecord } from '../utils/record-coerce.js';
|
|
2
3
|
const SESSION_KINDS = new Set(['tui', 'companion-task', 'companion-chat']);
|
|
3
4
|
const SESSION_STATUSES = new Set(['active', 'closed']);
|
|
4
5
|
const MESSAGE_ROLES = new Set(['user', 'assistant', 'system']);
|
|
5
|
-
function isRecord(value) {
|
|
6
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7
|
-
}
|
|
8
6
|
function isFiniteNumber(value) {
|
|
9
7
|
return typeof value === 'number' && Number.isFinite(value);
|
|
10
8
|
}
|
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Empty sections return null — the orchestrator omits them entirely (no header).
|
|
11
11
|
*/
|
|
12
|
-
import type { ProviderMessage } from '../providers/interface.js';
|
|
12
|
+
import type { ProviderMessage, ContentPart } from '../providers/interface.js';
|
|
13
13
|
import type { AgentRecord } from '../tools/agent/index.js';
|
|
14
14
|
import type { WrfcChain } from '../agents/wrfc-types.js';
|
|
15
15
|
import type { ExecutionPlan } from './execution-plan.js';
|
|
16
16
|
import type { CompactionSection, SessionMemory } from './compaction-types.js';
|
|
17
|
+
/** Extract plain text from a ProviderMessage content field. */
|
|
18
|
+
export declare function extractText(content: string | ContentPart[]): string;
|
|
19
|
+
/** Returns true when an agent should be considered active (running or pending). */
|
|
20
|
+
export declare function isActiveAgent(a: AgentRecord): boolean;
|
|
17
21
|
/**
|
|
18
22
|
* buildHandoffHeader — always returns the mandatory handoff header.
|
|
19
23
|
* This is the first line of every compacted output.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-sections.d.ts","sourceRoot":"","sources":["../../../src/platform/core/compaction-sections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"compaction-sections.d.ts","sourceRoot":"","sources":["../../../src/platform/core/compaction-sections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAoB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGhG,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,MAAM,CAMnE;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAErD;AAsBD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,iBAAiB,CAStD;AAMD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,aAAa,EAAE,GACxB,iBAAiB,GAAG,IAAI,CAQ1B;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B,iBAAiB,GAAG,IAAI,CAM1B;AAMD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,SAAS,EAAE,GAClB,iBAAiB,GAAG,IAAI,CAmB1B;AAMD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,eAAe,EAAE,EAC3B,SAAS,SAAO,GACf,eAAe,EAAE,CAkBnB;AAqCD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,eAAe,EAAE,GAAG,MAAM,CAgB9E;AAMD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,eAAe,EAAE,GAClC,MAAM,CAkBR;AAMD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EAAE,EACnB,WAAW,EAAE,MAAM,GAClB;IAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAAC,eAAe,EAAE,SAAS,EAAE,CAAA;CAAE,CA8CrE;AAsBD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CA2B7E;AAMD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,eAAe,EAAE,GAC1B,MAAM,CAgBR;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,aAAa,GAAG,IAAI,GACzB,iBAAiB,GAAG,IAAI,CAuC1B;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,cAAc,EAAE,MAAM,EAAE,EACxB,eAAe,EAAE,MAAM,GACtB,iBAAiB,GAAG,IAAI,CAa1B"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { estimateTokens } from './compaction-types.js';
|
|
13
13
|
/** Extract plain text from a ProviderMessage content field. */
|
|
14
|
-
function extractText(content) {
|
|
14
|
+
export function extractText(content) {
|
|
15
15
|
if (typeof content === 'string')
|
|
16
16
|
return content;
|
|
17
17
|
return content
|
|
@@ -19,6 +19,10 @@ function extractText(content) {
|
|
|
19
19
|
.map((p) => p.text)
|
|
20
20
|
.join('');
|
|
21
21
|
}
|
|
22
|
+
/** Returns true when an agent should be considered active (running or pending). */
|
|
23
|
+
export function isActiveAgent(a) {
|
|
24
|
+
return a.status === 'running' || a.status === 'pending';
|
|
25
|
+
}
|
|
22
26
|
/** Build a CompactionSection. Returns null if content is empty. */
|
|
23
27
|
function makeSection(id, header, content) {
|
|
24
28
|
const trimmed = content.trim();
|
|
@@ -83,7 +87,7 @@ export function buildCurrentTask(planTitle, lastUserMessage) {
|
|
|
83
87
|
* Returns null if no agents are running.
|
|
84
88
|
*/
|
|
85
89
|
export function buildRunningAgents(agents, chains) {
|
|
86
|
-
const active = agents.filter(
|
|
90
|
+
const active = agents.filter(isActiveAgent);
|
|
87
91
|
if (active.length === 0)
|
|
88
92
|
return null;
|
|
89
93
|
// Build a map from agent ID to chain ID for quick lookup
|
|
@@ -129,35 +133,52 @@ export function gatherRecentConversation(messages, maxTokens = 3000) {
|
|
|
129
133
|
// ---------------------------------------------------------------------------
|
|
130
134
|
// LLM substance filter prompt
|
|
131
135
|
// ---------------------------------------------------------------------------
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
export function buildToolResultsPrompt(toolMessages) {
|
|
138
|
-
if (toolMessages.length === 0)
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// Shared delimited-message prompt scaffold
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
function buildDelimitedMessagePrompt(opts) {
|
|
140
|
+
if (opts.messages.length === 0)
|
|
139
141
|
return '';
|
|
140
142
|
const parts = [
|
|
141
|
-
|
|
142
|
-
'Include: file paths touched with what was done (created/edited/deleted), any error outputs',
|
|
143
|
-
'that have not been resolved, any build/test results.',
|
|
144
|
-
'Max 1,500 tokens. Use relative paths and short descriptions.',
|
|
143
|
+
...opts.intro,
|
|
145
144
|
'',
|
|
146
|
-
|
|
145
|
+
`--- ${opts.delimiter} ---`,
|
|
147
146
|
'',
|
|
148
147
|
];
|
|
149
|
-
for (const msg of
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
parts.push(
|
|
148
|
+
for (const msg of opts.messages) {
|
|
149
|
+
const line = opts.render(msg);
|
|
150
|
+
if (line != null) {
|
|
151
|
+
parts.push(line);
|
|
153
152
|
parts.push('');
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
|
-
parts.push(
|
|
155
|
+
parts.push(`--- END ${opts.delimiter} ---`);
|
|
157
156
|
parts.push('');
|
|
158
|
-
parts.push(
|
|
157
|
+
parts.push(opts.outro);
|
|
159
158
|
return parts.join('\n');
|
|
160
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* buildToolResultsPrompt — build the prompt for LLM-assisted tool relevance extraction.
|
|
162
|
+
*
|
|
163
|
+
* The caller sends this to the LLM and uses the response as the section content.
|
|
164
|
+
*/
|
|
165
|
+
export function buildToolResultsPrompt(toolMessages) {
|
|
166
|
+
return buildDelimitedMessagePrompt({
|
|
167
|
+
intro: [
|
|
168
|
+
'From these tool call results, select the ones that are still relevant for ongoing work.',
|
|
169
|
+
'Include: file paths touched with what was done (created/edited/deleted), any error outputs',
|
|
170
|
+
'that have not been resolved, any build/test results.',
|
|
171
|
+
'Max 1,500 tokens. Use relative paths and short descriptions.',
|
|
172
|
+
],
|
|
173
|
+
delimiter: 'TOOL RESULTS',
|
|
174
|
+
messages: toolMessages,
|
|
175
|
+
render: (msg) => {
|
|
176
|
+
const text = extractText(msg.content);
|
|
177
|
+
return text.trim() ? `[tool]: ${text.trim().slice(0, 2000)}` : null;
|
|
178
|
+
},
|
|
179
|
+
outro: 'Provide a concise summary of relevant tool results now:',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
161
182
|
// ---------------------------------------------------------------------------
|
|
162
183
|
// Recent conversation substance filter prompt
|
|
163
184
|
// ---------------------------------------------------------------------------
|
|
@@ -169,30 +190,23 @@ export function buildToolResultsPrompt(toolMessages) {
|
|
|
169
190
|
* Multi-turn coherence rule: keep user-assistant PAIRS.
|
|
170
191
|
*/
|
|
171
192
|
export function buildConversationFilterPrompt(gatheredMessages) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
'',
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
parts.push('');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
parts.push('--- END RECENT MESSAGES ---');
|
|
193
|
-
parts.push('');
|
|
194
|
-
parts.push('Return the filtered messages in the same [role]: content format:');
|
|
195
|
-
return parts.join('\n');
|
|
193
|
+
return buildDelimitedMessagePrompt({
|
|
194
|
+
intro: [
|
|
195
|
+
'From these recent messages, remove anything that does not advance the work:',
|
|
196
|
+
'short acknowledgments, agent count updates, repetitive system nudges, status confirmations.',
|
|
197
|
+
'Keep: instructions, planning, decisions, task assignments, requirement changes.',
|
|
198
|
+
'ALL user messages are high-priority — bias toward keeping them even if short.',
|
|
199
|
+
'Keep user-assistant pairs together: if you keep an assistant message, keep the user message that prompted it.',
|
|
200
|
+
'Return only the messages worth preserving, in original order.',
|
|
201
|
+
],
|
|
202
|
+
delimiter: 'RECENT MESSAGES',
|
|
203
|
+
messages: gatheredMessages,
|
|
204
|
+
render: (msg) => {
|
|
205
|
+
const text = extractText(msg.content);
|
|
206
|
+
return text.trim() ? `[${msg.role}]: ${text.trim()}` : null;
|
|
207
|
+
},
|
|
208
|
+
outro: 'Return the filtered messages in the same [role]: content format:',
|
|
209
|
+
});
|
|
196
210
|
}
|
|
197
211
|
// ---------------------------------------------------------------------------
|
|
198
212
|
// Agent activity table
|
|
@@ -302,28 +316,21 @@ export function buildOlderAgentSummaryPrompt(olderChains) {
|
|
|
302
316
|
* Returns empty string if no messages.
|
|
303
317
|
*/
|
|
304
318
|
export function buildResolvedProblemsPrompt(messages) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
'',
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if
|
|
319
|
-
|
|
320
|
-
parts.push('');
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
parts.push('--- END CONVERSATION ---');
|
|
324
|
-
parts.push('');
|
|
325
|
-
parts.push('List resolved problems now (or return empty if none):');
|
|
326
|
-
return parts.join('\n');
|
|
319
|
+
return buildDelimitedMessagePrompt({
|
|
320
|
+
intro: [
|
|
321
|
+
'Extract problem → resolution pairs from this conversation.',
|
|
322
|
+
'Only include problems that were actually resolved. One line each.',
|
|
323
|
+
'Format: problem → resolution.',
|
|
324
|
+
'Highlight the resolution, not the debugging journey.',
|
|
325
|
+
],
|
|
326
|
+
delimiter: 'CONVERSATION',
|
|
327
|
+
messages,
|
|
328
|
+
render: (msg) => {
|
|
329
|
+
const text = extractText(msg.content);
|
|
330
|
+
return text.trim() ? `[${msg.role}]: ${text.trim().slice(0, 1000)}` : null;
|
|
331
|
+
},
|
|
332
|
+
outro: 'List resolved problems now (or return empty if none):',
|
|
333
|
+
});
|
|
327
334
|
}
|
|
328
335
|
// ---------------------------------------------------------------------------
|
|
329
336
|
// Plan progress
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-compaction.d.ts","sourceRoot":"","sources":["../../../src/platform/core/context-compaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAEhB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"context-compaction.d.ts","sourceRoot":"","sources":["../../../src/platform/core/context-compaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAoB/B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAElG,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,YAAY,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC;AAMD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAQ7C,wBAAgB,mBAAmB,IAAI,SAAS,eAAe,EAAE,CAEhE;AAED,wBAAgB,sBAAsB,IAAI,eAAe,GAAG,IAAI,CAI/D;AAMD,0EAA0E;AAC1E,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,MAAM,CAc9E;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAYvD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,GAAG,mBAAmB,CA6BpF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAEnE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EAAE,EAC3B,UAAU,SAAK,GACd,eAAe,EAAE,CAanB;AAqHD;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,iBAAiB,EACtB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AA0OD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,EAAE,iBAAiB,EACtB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAOlC"}
|