@moltzap/client 2026.806.0 → 2026.812.0
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/channel-base/index.d.ts +4 -4
- package/dist/channel-base/index.d.ts.map +1 -1
- package/dist/channel-base/index.js +6 -3
- package/dist/channel-base/index.js.map +1 -1
- package/dist/channel-core-enrichment.d.ts +24 -0
- package/dist/channel-core-enrichment.d.ts.map +1 -1
- package/dist/channel-core-enrichment.js +94 -20
- package/dist/channel-core-enrichment.js.map +1 -1
- package/dist/channel-core.d.ts +3 -1
- package/dist/channel-core.d.ts.map +1 -1
- package/dist/channel-core.js +2 -0
- package/dist/channel-core.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -1
- package/dist/config.js.map +1 -1
- package/dist/config.test-utils.d.ts +6 -0
- package/dist/config.test-utils.d.ts.map +1 -1
- package/dist/config.test-utils.js +5 -1
- package/dist/config.test-utils.js.map +1 -1
- package/dist/harness/client-runtime.d.ts +12 -5
- package/dist/harness/client-runtime.d.ts.map +1 -1
- package/dist/harness/client-runtime.js +16 -2
- package/dist/harness/client-runtime.js.map +1 -1
- package/dist/harness/index.d.ts +2 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +2 -2
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/runtime.d.ts +152 -0
- package/dist/harness/runtime.d.ts.map +1 -1
- package/dist/harness/runtime.js +99 -2
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness-client.d.ts +17 -13
- package/dist/harness-client.d.ts.map +1 -1
- package/dist/harness-client.js +59 -4
- package/dist/harness-client.js.map +1 -1
- package/dist/harness-context-projection.d.ts +35 -0
- package/dist/harness-context-projection.d.ts.map +1 -0
- package/dist/harness-context-projection.js +123 -0
- package/dist/harness-context-projection.js.map +1 -0
- package/dist/harness-mcp-server.d.ts +1 -2
- package/dist/harness-mcp-server.d.ts.map +1 -1
- package/dist/harness-mcp-server.js +11 -17
- package/dist/harness-mcp-server.js.map +1 -1
- package/dist/harness-mcp-wire.d.ts +47 -15
- package/dist/harness-mcp-wire.d.ts.map +1 -1
- package/dist/harness-mcp-wire.js +93 -37
- package/dist/harness-mcp-wire.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/local-paths.d.ts +0 -11
- package/dist/local-paths.d.ts.map +1 -1
- package/dist/local-paths.js +0 -12
- package/dist/local-paths.js.map +1 -1
- package/dist/moltzapd-catalog.d.ts +35 -0
- package/dist/moltzapd-catalog.d.ts.map +1 -0
- package/dist/moltzapd-catalog.js +117 -0
- package/dist/moltzapd-catalog.js.map +1 -0
- package/dist/moltzapd-child-ipc.d.ts +26 -0
- package/dist/moltzapd-child-ipc.d.ts.map +1 -0
- package/dist/moltzapd-child-ipc.js +31 -0
- package/dist/moltzapd-child-ipc.js.map +1 -0
- package/dist/moltzapd-child.d.ts +55 -0
- package/dist/moltzapd-child.d.ts.map +1 -0
- package/dist/moltzapd-child.js +225 -0
- package/dist/moltzapd-child.js.map +1 -0
- package/dist/moltzapd-main.d.ts +3 -0
- package/dist/moltzapd-main.d.ts.map +1 -0
- package/dist/moltzapd-main.js +18 -0
- package/dist/moltzapd-main.js.map +1 -0
- package/dist/moltzapd-registration.d.ts +40 -0
- package/dist/moltzapd-registration.d.ts.map +1 -0
- package/dist/moltzapd-registration.js +59 -0
- package/dist/moltzapd-registration.js.map +1 -0
- package/dist/moltzapd.d.ts +56 -9
- package/dist/moltzapd.d.ts.map +1 -1
- package/dist/moltzapd.js +108 -36
- package/dist/moltzapd.js.map +1 -1
- package/dist/notification/trace.d.ts +10 -0
- package/dist/notification/trace.d.ts.map +1 -0
- package/dist/notification/trace.js +34 -0
- package/dist/notification/trace.js.map +1 -0
- package/dist/presentation/index.d.ts +3 -0
- package/dist/presentation/index.d.ts.map +1 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/index.js.map +1 -0
- package/dist/presentation/state.d.ts +77 -0
- package/dist/presentation/state.d.ts.map +1 -0
- package/dist/presentation/state.js +211 -0
- package/dist/presentation/state.js.map +1 -0
- package/dist/profile.d.ts +30 -28
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +28 -20
- package/dist/profile.js.map +1 -1
- package/dist/service.d.ts +8 -79
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +29 -333
- package/dist/service.js.map +1 -1
- package/dist/test-utils/fake-service.d.ts +3 -5
- package/dist/test-utils/fake-service.d.ts.map +1 -1
- package/dist/test-utils/fake-service.js +12 -12
- package/dist/test-utils/fake-service.js.map +1 -1
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +2 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/process/reserve-port.d.ts +20 -0
- package/dist/test-utils/process/reserve-port.d.ts.map +1 -0
- package/dist/test-utils/process/reserve-port.js +41 -0
- package/dist/test-utils/process/reserve-port.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -6
- package/dist/cli/adapters.d.ts +0 -21
- package/dist/cli/adapters.d.ts.map +0 -1
- package/dist/cli/adapters.js +0 -111
- package/dist/cli/adapters.js.map +0 -1
- package/dist/cli/commands/agents.d.ts +0 -11
- package/dist/cli/commands/agents.d.ts.map +0 -1
- package/dist/cli/commands/agents.js +0 -27
- package/dist/cli/commands/agents.js.map +0 -1
- package/dist/cli/commands/conversations.d.ts +0 -18
- package/dist/cli/commands/conversations.d.ts.map +0 -1
- package/dist/cli/commands/conversations.js +0 -33
- package/dist/cli/commands/conversations.js.map +0 -1
- package/dist/cli/commands/messages.d.ts +0 -41
- package/dist/cli/commands/messages.d.ts.map +0 -1
- package/dist/cli/commands/messages.js +0 -39
- package/dist/cli/commands/messages.js.map +0 -1
- package/dist/cli/commands/register.d.ts +0 -46
- package/dist/cli/commands/register.d.ts.map +0 -1
- package/dist/cli/commands/register.js +0 -103
- package/dist/cli/commands/register.js.map +0 -1
- package/dist/cli/commands/send.d.ts +0 -53
- package/dist/cli/commands/send.d.ts.map +0 -1
- package/dist/cli/commands/send.js +0 -57
- package/dist/cli/commands/send.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -34
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/commands/start.js +0 -59
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -7
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -16
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/test-transport.d.ts +0 -28
- package/dist/cli/commands/test-transport.d.ts.map +0 -1
- package/dist/cli/commands/test-transport.js +0 -40
- package/dist/cli/commands/test-transport.js.map +0 -1
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -105
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/output.d.ts +0 -14
- package/dist/cli/output.d.ts.map +0 -1
- package/dist/cli/output.js +0 -19
- package/dist/cli/output.js.map +0 -1
- package/dist/cli/socket-client.d.ts +0 -28
- package/dist/cli/socket-client.d.ts.map +0 -1
- package/dist/cli/socket-client.js +0 -63
- package/dist/cli/socket-client.js.map +0 -1
- package/dist/cli/transport.d.ts +0 -132
- package/dist/cli/transport.d.ts.map +0 -1
- package/dist/cli/transport.js +0 -127
- package/dist/cli/transport.js.map +0 -1
- package/dist/local-daemon-rpc.d.ts +0 -1170
- package/dist/local-daemon-rpc.d.ts.map +0 -1
- package/dist/local-daemon-rpc.js +0 -178
- package/dist/local-daemon-rpc.js.map +0 -1
- package/dist/local-history.d.ts +0 -75
- package/dist/local-history.d.ts.map +0 -1
- package/dist/local-history.js +0 -82
- package/dist/local-history.js.map +0 -1
- package/dist/local-socket-server.d.ts +0 -33
- package/dist/local-socket-server.d.ts.map +0 -1
- package/dist/local-socket-server.js +0 -100
- package/dist/local-socket-server.js.map +0 -1
- package/dist/refs.d.ts +0 -18
- package/dist/refs.d.ts.map +0 -1
- package/dist/refs.js +0 -18
- package/dist/refs.js.map +0 -1
- package/dist/service-helpers.d.ts +0 -55
- package/dist/service-helpers.d.ts.map +0 -1
- package/dist/service-helpers.js +0 -108
- package/dist/service-helpers.js.map +0 -1
- package/dist/service-local-daemon.d.ts +0 -32
- package/dist/service-local-daemon.d.ts.map +0 -1
- package/dist/service-local-daemon.js +0 -153
- package/dist/service-local-daemon.js.map +0 -1
package/dist/harness/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export { acquireHarnessClientInternal } from "./client-runtime.js";
|
|
2
|
+
export { acquireHarnessClientInternal, type HarnessClientInternalService, type HarnessTurnInternal, } from "./client-runtime.js";
|
|
3
3
|
/** @internal */
|
|
4
|
-
export { decodeHarnessReplyRoute, HARNESS_EVENTS_EXTENSION, HARNESS_REPLY_TOOL, HARNESS_TURN_READY_FILTER, HARNESS_TURN_READY_NOTIFICATION, harnessReplyInputJsonSchema, harnessReplyResultJsonSchema, type HarnessReplyInput, type HarnessReplyResult, type HarnessReplyRoute, type HarnessTurnEvent, } from "./runtime.js";
|
|
4
|
+
export { decodeHarnessReplyRoute, decodeHarnessSearchConversationsResult, decodeHarnessStartConversationResult, decodeHarnessStatusResult, HARNESS_EVENTS_EXTENSION, HARNESS_READ_CONVERSATION_TOOL, HARNESS_REGISTER_TOOL, HARNESS_REPLY_TOOL, HARNESS_SEARCH_AGENTS_TOOL, HARNESS_SEARCH_CONVERSATIONS_TOOL, HARNESS_START_CONVERSATION_TOOL, HARNESS_STATUS_TOOL, HARNESS_TURN_READY_FILTER, HARNESS_TURN_READY_NOTIFICATION, harnessSearchConversationsResultJsonSchema, harnessReplyInputJsonSchema, harnessReplyResultJsonSchema, type ConversationWithParticipants, type HarnessReplyInput, type HarnessReplyResult, type HarnessReplyRoute, type HarnessSearchConversationsResult, harnessStartConversationInputJsonSchema, harnessStartConversationResultJsonSchema, type HarnessStartConversationInput, type HarnessStartConversationResult, harnessRegisterInputJsonSchema, harnessRegisterResultJsonSchema, type HarnessRegisterInput, type HarnessRegisterResult, harnessStatusInputJsonSchema, harnessStatusResultJsonSchema, type HarnessStatusInput, type HarnessStatusResult, type HarnessTurnEvent, } from "./runtime.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EACL,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,gBAAgB;AAChB,OAAO,EACL,uBAAuB,EACvB,sCAAsC,EACtC,oCAAoC,EACpC,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,mBAAmB,EACnB,yBAAyB,EACzB,+BAA+B,EAC/B,0CAA0C,EAC1C,2BAA2B,EAC3B,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gCAAgC,EACrC,uCAAuC,EACvC,wCAAwC,EACxC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,8BAA8B,EAC9B,+BAA+B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC"}
|
package/dist/harness/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export { acquireHarnessClientInternal } from "./client-runtime.js";
|
|
2
|
+
export { acquireHarnessClientInternal, } from "./client-runtime.js";
|
|
3
3
|
/** @internal */
|
|
4
|
-
export { decodeHarnessReplyRoute, HARNESS_EVENTS_EXTENSION, HARNESS_REPLY_TOOL, HARNESS_TURN_READY_FILTER, HARNESS_TURN_READY_NOTIFICATION, harnessReplyInputJsonSchema, harnessReplyResultJsonSchema, } from "./runtime.js";
|
|
4
|
+
export { decodeHarnessReplyRoute, decodeHarnessSearchConversationsResult, decodeHarnessStartConversationResult, decodeHarnessStatusResult, HARNESS_EVENTS_EXTENSION, HARNESS_READ_CONVERSATION_TOOL, HARNESS_REGISTER_TOOL, HARNESS_REPLY_TOOL, HARNESS_SEARCH_AGENTS_TOOL, HARNESS_SEARCH_CONVERSATIONS_TOOL, HARNESS_START_CONVERSATION_TOOL, HARNESS_STATUS_TOOL, HARNESS_TURN_READY_FILTER, HARNESS_TURN_READY_NOTIFICATION, harnessSearchConversationsResultJsonSchema, harnessReplyInputJsonSchema, harnessReplyResultJsonSchema, harnessStartConversationInputJsonSchema, harnessStartConversationResultJsonSchema, harnessRegisterInputJsonSchema, harnessRegisterResultJsonSchema, harnessStatusInputJsonSchema, harnessStatusResultJsonSchema, } from "./runtime.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EACL,4BAA4B,GAG7B,MAAM,qBAAqB,CAAC;AAC7B,gBAAgB;AAChB,OAAO,EACL,uBAAuB,EACvB,sCAAsC,EACtC,oCAAoC,EACpC,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,mBAAmB,EACnB,yBAAyB,EACzB,+BAA+B,EAC/B,0CAA0C,EAC1C,2BAA2B,EAC3B,4BAA4B,EAM5B,uCAAuC,EACvC,wCAAwC,EAGxC,8BAA8B,EAC9B,+BAA+B,EAG/B,4BAA4B,EAC5B,6BAA6B,GAI9B,MAAM,cAAc,CAAC"}
|
|
@@ -6,8 +6,59 @@ export declare const HARNESS_EVENTS_EXTENSION = "xyz.moltzap/events-v1";
|
|
|
6
6
|
export declare const HARNESS_TURN_READY_FILTER = "xyz.moltzap/turnReady";
|
|
7
7
|
/** Notification method carrying one coalesced inbound turn. */
|
|
8
8
|
export declare const HARNESS_TURN_READY_NOTIFICATION = "notifications/xyz.moltzap/turn_ready";
|
|
9
|
+
/**
|
|
10
|
+
* Tool committing a Registry identity to the slot this daemon owns. Present
|
|
11
|
+
* only while the slot has none; the six active tools replace it afterward.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HARNESS_REGISTER_TOOL = "register";
|
|
9
14
|
/** Tool used for model output in the current conversation. */
|
|
10
15
|
export declare const HARNESS_REPLY_TOOL = "reply";
|
|
16
|
+
/** Tool returning the active daemon identity and connection state. */
|
|
17
|
+
export declare const HARNESS_STATUS_TOOL = "status";
|
|
18
|
+
/** Tool browsing or matching visible agent cards. */
|
|
19
|
+
export declare const HARNESS_SEARCH_AGENTS_TOOL = "search_agents";
|
|
20
|
+
/** Tool browsing or matching visible conversations. */
|
|
21
|
+
export declare const HARNESS_SEARCH_CONVERSATIONS_TOOL = "search_conversations";
|
|
22
|
+
/** Tool reading one checkpointed conversation history. */
|
|
23
|
+
export declare const HARNESS_READ_CONVERSATION_TOOL = "read_conversation";
|
|
24
|
+
/** Tool creating a conversation and sending its initial content. */
|
|
25
|
+
export declare const HARNESS_START_CONVERSATION_TOOL = "start_conversation";
|
|
26
|
+
declare const conversationWithParticipantsSchema: Schema.Struct<{
|
|
27
|
+
id: Schema.Schema<ConversationId, string, never>;
|
|
28
|
+
name: Schema.optional<typeof Schema.String>;
|
|
29
|
+
createdBy: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
|
|
30
|
+
createdAt: Schema.Schema<string, string, never>;
|
|
31
|
+
updatedAt: Schema.Schema<string, string, never>;
|
|
32
|
+
participants: Schema.Array$<Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>>;
|
|
33
|
+
}>;
|
|
34
|
+
/** Arguments for creating a conversation through the harness. */
|
|
35
|
+
declare const harnessStartConversationInputSchema: Schema.Struct<{
|
|
36
|
+
otherAgentNames: Schema.NonEmptyArray<Schema.Schema<import("@moltzap/protocol/identity").AgentName, string, never>>;
|
|
37
|
+
initialContent: Schema.filter<typeof Schema.String>;
|
|
38
|
+
}>;
|
|
39
|
+
/** Conversation returned after its initial content has been sent. */
|
|
40
|
+
declare const harnessStartConversationResultSchema: Schema.Struct<{
|
|
41
|
+
conversation: Schema.Struct<{
|
|
42
|
+
id: Schema.Schema<ConversationId, string, never>;
|
|
43
|
+
name: Schema.optional<typeof Schema.String>;
|
|
44
|
+
createdBy: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
|
|
45
|
+
createdAt: Schema.Schema<string, string, never>;
|
|
46
|
+
updatedAt: Schema.Schema<string, string, never>;
|
|
47
|
+
participants: Schema.Array$<Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>>;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
/** MCP-local search result used to reconstruct endpoint presentation. */
|
|
51
|
+
declare const harnessSearchConversationsResultSchema: Schema.Struct<{
|
|
52
|
+
nextCursor: Schema.optional<Schema.Schema<import("@moltzap/protocol/rpc").ListCursor, string, never>>;
|
|
53
|
+
conversations: Schema.Array$<Schema.Struct<{
|
|
54
|
+
id: Schema.Schema<ConversationId, string, never>;
|
|
55
|
+
name: Schema.optional<typeof Schema.String>;
|
|
56
|
+
createdBy: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
|
|
57
|
+
createdAt: Schema.Schema<string, string, never>;
|
|
58
|
+
updatedAt: Schema.Schema<string, string, never>;
|
|
59
|
+
participants: Schema.Array$<Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>>;
|
|
60
|
+
}>>;
|
|
61
|
+
}>;
|
|
11
62
|
/** One nonempty batch of protocol messages delivered as a model turn. */
|
|
12
63
|
declare const harnessTurnEventSchema: Schema.filter<Schema.Struct<{
|
|
13
64
|
messages: Schema.NonEmptyArray<Schema.Struct<{
|
|
@@ -41,18 +92,78 @@ declare const harnessReplyResultSchema: Schema.Struct<{}>;
|
|
|
41
92
|
declare const harnessReplyRouteSchema: Schema.Struct<{
|
|
42
93
|
conversationId: Schema.Schema<ConversationId, string, never>;
|
|
43
94
|
}>;
|
|
95
|
+
/**
|
|
96
|
+
* The daemon supplies the agent name and listener port from its own slot, so
|
|
97
|
+
* registration arguments carry only what the Registry cannot derive locally.
|
|
98
|
+
*/
|
|
99
|
+
declare const harnessRegisterInputSchema: Schema.Struct<{
|
|
100
|
+
inviteCode: Schema.optional<Schema.filter<typeof Schema.String>>;
|
|
101
|
+
description: Schema.optional<Schema.filter<typeof Schema.String>>;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Registration reports the committed identity and where it is reachable. Key
|
|
105
|
+
* material is written to the slot and never returned over MCP.
|
|
106
|
+
*/
|
|
107
|
+
declare const harnessRegisterResultSchema: Schema.Struct<{
|
|
108
|
+
agentId: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
|
|
109
|
+
agentName: typeof Schema.String;
|
|
110
|
+
serverUrl: typeof Schema.String;
|
|
111
|
+
}>;
|
|
112
|
+
/** Status takes no arguments; the daemon reports on the slot it already owns. */
|
|
113
|
+
declare const harnessStatusInputSchema: Schema.Struct<{}>;
|
|
114
|
+
/** Active daemon identity and connection state. */
|
|
115
|
+
declare const harnessStatusResultSchema: Schema.Struct<{
|
|
116
|
+
agentId: Schema.optional<Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>>;
|
|
117
|
+
connected: typeof Schema.Boolean;
|
|
118
|
+
conversations: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
119
|
+
}>;
|
|
44
120
|
/** Decoded harness turn event. */
|
|
45
121
|
export type HarnessTurnEvent = Schema.Schema.Type<typeof harnessTurnEventSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* Conversation plus its membership, assembled by the daemon because the
|
|
124
|
+
* canonical Conversation sent over the network carries no participants. It
|
|
125
|
+
* crosses only the loopback MCP boundary, and it is public because it names
|
|
126
|
+
* what `HarnessClientService.startConversation` hands back to an adapter.
|
|
127
|
+
*/
|
|
128
|
+
export type ConversationWithParticipants = Schema.Schema.Type<typeof conversationWithParticipantsSchema>;
|
|
129
|
+
/** Decoded start-conversation input. */
|
|
130
|
+
export type HarnessStartConversationInput = Schema.Schema.Type<typeof harnessStartConversationInputSchema>;
|
|
131
|
+
/** Decoded start-conversation result. */
|
|
132
|
+
export type HarnessStartConversationResult = Schema.Schema.Type<typeof harnessStartConversationResultSchema>;
|
|
133
|
+
/** Decoded MCP-local conversation search page. */
|
|
134
|
+
export type HarnessSearchConversationsResult = Schema.Schema.Type<typeof harnessSearchConversationsResultSchema>;
|
|
46
135
|
/** Decoded reply input. */
|
|
47
136
|
export type HarnessReplyInput = Schema.Schema.Type<typeof harnessReplyInputSchema>;
|
|
48
137
|
/** Decoded reply result. */
|
|
49
138
|
export type HarnessReplyResult = Schema.Schema.Type<typeof harnessReplyResultSchema>;
|
|
50
139
|
/** Decoded private reply route. */
|
|
51
140
|
export type HarnessReplyRoute = Schema.Schema.Type<typeof harnessReplyRouteSchema>;
|
|
141
|
+
/** Decoded registration input. */
|
|
142
|
+
export type HarnessRegisterInput = Schema.Schema.Type<typeof harnessRegisterInputSchema>;
|
|
143
|
+
/** Decoded registration result. */
|
|
144
|
+
export type HarnessRegisterResult = Schema.Schema.Type<typeof harnessRegisterResultSchema>;
|
|
145
|
+
/** Decoded status input. */
|
|
146
|
+
export type HarnessStatusInput = Schema.Schema.Type<typeof harnessStatusInputSchema>;
|
|
147
|
+
/** Decoded status result. */
|
|
148
|
+
export type HarnessStatusResult = Schema.Schema.Type<typeof harnessStatusResultSchema>;
|
|
149
|
+
/** JSON Schema advertised for start-conversation arguments. */
|
|
150
|
+
export declare const harnessStartConversationInputJsonSchema: JSONSchema.JsonSchema7Root;
|
|
151
|
+
/** JSON Schema advertised for the start-conversation result. */
|
|
152
|
+
export declare const harnessStartConversationResultJsonSchema: JSONSchema.JsonSchema7Root;
|
|
153
|
+
/** JSON Schema advertised for the MCP-local conversation search result. */
|
|
154
|
+
export declare const harnessSearchConversationsResultJsonSchema: JSONSchema.JsonSchema7Root;
|
|
52
155
|
/** JSON Schema advertised for the payload-only reply tool arguments. */
|
|
53
156
|
export declare const harnessReplyInputJsonSchema: JSONSchema.JsonSchema7Root;
|
|
54
157
|
/** JSON Schema advertised for the empty reply result. */
|
|
55
158
|
export declare const harnessReplyResultJsonSchema: JSONSchema.JsonSchema7Root;
|
|
159
|
+
/** JSON Schema advertised for registration arguments. */
|
|
160
|
+
export declare const harnessRegisterInputJsonSchema: JSONSchema.JsonSchema7Root;
|
|
161
|
+
/** JSON Schema advertised for the registration result. */
|
|
162
|
+
export declare const harnessRegisterResultJsonSchema: JSONSchema.JsonSchema7Root;
|
|
163
|
+
/** JSON Schema advertised for the empty status arguments. */
|
|
164
|
+
export declare const harnessStatusInputJsonSchema: JSONSchema.JsonSchema7Root;
|
|
165
|
+
/** JSON Schema advertised for the status result. */
|
|
166
|
+
export declare const harnessStatusResultJsonSchema: JSONSchema.JsonSchema7Root;
|
|
56
167
|
/**
|
|
57
168
|
* Strictly decode a turn event received from the MCP boundary.
|
|
58
169
|
* @param value Untrusted notification parameters.
|
|
@@ -125,6 +236,47 @@ export declare const decodeHarnessTurnEvent: (value: unknown) => import("effect/
|
|
|
125
236
|
readonly createdAt: string;
|
|
126
237
|
}[]];
|
|
127
238
|
}, import("effect/ParseResult").ParseError, never>;
|
|
239
|
+
/**
|
|
240
|
+
* Strictly decode the membership-bearing conversation page received over MCP.
|
|
241
|
+
* @param value Untrusted structured tool content.
|
|
242
|
+
* @returns The decoded MCP-local conversation page.
|
|
243
|
+
*/
|
|
244
|
+
export declare const decodeHarnessSearchConversationsResult: (value: unknown) => import("effect/Effect").Effect<{
|
|
245
|
+
readonly nextCursor?: import("@moltzap/protocol/rpc").ListCursor | undefined;
|
|
246
|
+
readonly conversations: readonly {
|
|
247
|
+
readonly id: ConversationId;
|
|
248
|
+
readonly name?: string | undefined;
|
|
249
|
+
readonly createdBy: import("@moltzap/protocol/identity").AgentId;
|
|
250
|
+
readonly createdAt: string;
|
|
251
|
+
readonly updatedAt: string;
|
|
252
|
+
readonly participants: readonly import("@moltzap/protocol/identity").AgentId[];
|
|
253
|
+
}[];
|
|
254
|
+
}, import("effect/ParseResult").ParseError, never>;
|
|
255
|
+
/**
|
|
256
|
+
* Strictly decode a conversation created through the harness MCP boundary.
|
|
257
|
+
* @param value Untrusted structured tool content.
|
|
258
|
+
* @returns The created conversation with MCP-local membership.
|
|
259
|
+
*/
|
|
260
|
+
export declare const decodeHarnessStartConversationResult: (value: unknown) => import("effect/Effect").Effect<{
|
|
261
|
+
readonly conversation: {
|
|
262
|
+
readonly id: ConversationId;
|
|
263
|
+
readonly name?: string | undefined;
|
|
264
|
+
readonly createdBy: import("@moltzap/protocol/identity").AgentId;
|
|
265
|
+
readonly createdAt: string;
|
|
266
|
+
readonly updatedAt: string;
|
|
267
|
+
readonly participants: readonly import("@moltzap/protocol/identity").AgentId[];
|
|
268
|
+
};
|
|
269
|
+
}, import("effect/ParseResult").ParseError, never>;
|
|
270
|
+
/**
|
|
271
|
+
* Strictly decode the daemon status reported over the MCP boundary.
|
|
272
|
+
* @param value Untrusted structured tool content.
|
|
273
|
+
* @returns The decoded identity and connection state.
|
|
274
|
+
*/
|
|
275
|
+
export declare const decodeHarnessStatusResult: (value: unknown) => import("effect/Effect").Effect<{
|
|
276
|
+
readonly agentId?: import("@moltzap/protocol/identity").AgentId | undefined;
|
|
277
|
+
readonly connected: boolean;
|
|
278
|
+
readonly conversations: number;
|
|
279
|
+
}, import("effect/ParseResult").ParseError, never>;
|
|
128
280
|
/**
|
|
129
281
|
* Build the private request metadata consumed by the production harness client.
|
|
130
282
|
* @param originatingConversationId Conversation associated with the live turn.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/harness/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/harness/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAIxC,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,0BAA0B,CAAC;AAEhE,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,+DAA+D;AAC/D,eAAO,MAAM,+BAA+B,yCACJ,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,qDAAqD;AACrD,eAAO,MAAM,0BAA0B,kBAAkB,CAAC;AAE1D,uDAAuD;AACvD,eAAO,MAAM,iCAAiC,yBAAyB,CAAC;AAExE,0DAA0D;AAC1D,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAElE,oEAAoE;AACpE,eAAO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,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,4BAGxC,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,6BAA6B,4BAGzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,UAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDACR,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,UAAW,OAAO;;;;;;;;;;kDACR,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,UAAW,OAAO;;;;;;;;;kDACR,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,UAAW,OAAO;;;;kDACR,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,8BACP,cAAc,KACxC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIjC,CAAC;AAOH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,gBAAiB,OAAO;;kDAK3D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,SAC9B,gBAAgB,KACrB,cAAiD,CAAC"}
|
package/dist/harness/runtime.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONSchema, Schema } from "effect";
|
|
2
|
-
import { conversationId, } from "@moltzap/protocol/conversation";
|
|
2
|
+
import { conversationId, conversationSchema, conversationSearch, } from "@moltzap/protocol/conversation";
|
|
3
|
+
import { agentId, agentName } from "@moltzap/protocol/identity";
|
|
3
4
|
import { messageReceivedNotificationDefinition } from "@moltzap/protocol/message";
|
|
4
5
|
/** Harness MCP extension carrying the runtime event contract. */
|
|
5
6
|
export const HARNESS_EVENTS_EXTENSION = "xyz.moltzap/events-v1";
|
|
@@ -7,9 +8,42 @@ export const HARNESS_EVENTS_EXTENSION = "xyz.moltzap/events-v1";
|
|
|
7
8
|
export const HARNESS_TURN_READY_FILTER = "xyz.moltzap/turnReady";
|
|
8
9
|
/** Notification method carrying one coalesced inbound turn. */
|
|
9
10
|
export const HARNESS_TURN_READY_NOTIFICATION = "notifications/xyz.moltzap/turn_ready";
|
|
11
|
+
/**
|
|
12
|
+
* Tool committing a Registry identity to the slot this daemon owns. Present
|
|
13
|
+
* only while the slot has none; the six active tools replace it afterward.
|
|
14
|
+
*/
|
|
15
|
+
export const HARNESS_REGISTER_TOOL = "register";
|
|
10
16
|
/** Tool used for model output in the current conversation. */
|
|
11
17
|
export const HARNESS_REPLY_TOOL = "reply";
|
|
18
|
+
/** Tool returning the active daemon identity and connection state. */
|
|
19
|
+
export const HARNESS_STATUS_TOOL = "status";
|
|
20
|
+
/** Tool browsing or matching visible agent cards. */
|
|
21
|
+
export const HARNESS_SEARCH_AGENTS_TOOL = "search_agents";
|
|
22
|
+
/** Tool browsing or matching visible conversations. */
|
|
23
|
+
export const HARNESS_SEARCH_CONVERSATIONS_TOOL = "search_conversations";
|
|
24
|
+
/** Tool reading one checkpointed conversation history. */
|
|
25
|
+
export const HARNESS_READ_CONVERSATION_TOOL = "read_conversation";
|
|
26
|
+
/** Tool creating a conversation and sending its initial content. */
|
|
27
|
+
export const HARNESS_START_CONVERSATION_TOOL = "start_conversation";
|
|
12
28
|
const messageSchema = messageReceivedNotificationDefinition.paramsSchema.fields.message;
|
|
29
|
+
const conversationWithParticipantsSchema = Schema.Struct({
|
|
30
|
+
...conversationSchema().fields,
|
|
31
|
+
participants: Schema.Array(agentId),
|
|
32
|
+
});
|
|
33
|
+
/** Arguments for creating a conversation through the harness. */
|
|
34
|
+
const harnessStartConversationInputSchema = Schema.Struct({
|
|
35
|
+
otherAgentNames: Schema.NonEmptyArray(agentName),
|
|
36
|
+
initialContent: Schema.String.pipe(Schema.minLength(1)),
|
|
37
|
+
});
|
|
38
|
+
/** Conversation returned after its initial content has been sent. */
|
|
39
|
+
const harnessStartConversationResultSchema = Schema.Struct({
|
|
40
|
+
conversation: conversationWithParticipantsSchema,
|
|
41
|
+
});
|
|
42
|
+
/** MCP-local search result used to reconstruct endpoint presentation. */
|
|
43
|
+
const harnessSearchConversationsResultSchema = Schema.Struct({
|
|
44
|
+
...conversationSearch.resultSchema.fields,
|
|
45
|
+
conversations: Schema.Array(conversationWithParticipantsSchema),
|
|
46
|
+
});
|
|
13
47
|
/** One nonempty batch of protocol messages delivered as a model turn. */
|
|
14
48
|
const harnessTurnEventSchema = Schema.Struct({
|
|
15
49
|
messages: Schema.NonEmptyArray(messageSchema),
|
|
@@ -24,19 +58,82 @@ const harnessReplyResultSchema = Schema.Struct({});
|
|
|
24
58
|
const harnessReplyRouteSchema = Schema.Struct({
|
|
25
59
|
conversationId,
|
|
26
60
|
});
|
|
61
|
+
/**
|
|
62
|
+
* The daemon supplies the agent name and listener port from its own slot, so
|
|
63
|
+
* registration arguments carry only what the Registry cannot derive locally.
|
|
64
|
+
*/
|
|
65
|
+
const harnessRegisterInputSchema = Schema.Struct({
|
|
66
|
+
inviteCode: Schema.optional(Schema.String.pipe(Schema.minLength(1))),
|
|
67
|
+
description: Schema.optional(Schema.String.pipe(Schema.maxLength(500))),
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Registration reports the committed identity and where it is reachable. Key
|
|
71
|
+
* material is written to the slot and never returned over MCP.
|
|
72
|
+
*/
|
|
73
|
+
const harnessRegisterResultSchema = Schema.Struct({
|
|
74
|
+
agentId,
|
|
75
|
+
// The slot stores its agent name unbranded and the Registry has already
|
|
76
|
+
// validated it by the time this result exists, so a second brand round-trip
|
|
77
|
+
// inside the daemon would assert nothing new.
|
|
78
|
+
agentName: Schema.String,
|
|
79
|
+
serverUrl: Schema.String,
|
|
80
|
+
});
|
|
81
|
+
/** Status takes no arguments; the daemon reports on the slot it already owns. */
|
|
82
|
+
const harnessStatusInputSchema = Schema.Struct({});
|
|
83
|
+
/** Active daemon identity and connection state. */
|
|
84
|
+
const harnessStatusResultSchema = Schema.Struct({
|
|
85
|
+
agentId: Schema.optional(agentId),
|
|
86
|
+
connected: Schema.Boolean,
|
|
87
|
+
conversations: Schema.Number.pipe(Schema.int(), Schema.nonNegative()),
|
|
88
|
+
});
|
|
89
|
+
const strictDecodeOptions = { onExcessProperty: "error" };
|
|
27
90
|
const decodeTurnEvent = Schema.decodeUnknown(harnessTurnEventSchema);
|
|
91
|
+
const decodeSearchConversationsResult = Schema.decodeUnknown(harnessSearchConversationsResultSchema);
|
|
92
|
+
const decodeStartConversationResult = Schema.decodeUnknown(harnessStartConversationResultSchema);
|
|
28
93
|
const decodeReplyRoute = Schema.decodeUnknown(harnessReplyRouteSchema);
|
|
29
|
-
const
|
|
94
|
+
const decodeStatusResult = Schema.decodeUnknown(harnessStatusResultSchema);
|
|
95
|
+
/** JSON Schema advertised for start-conversation arguments. */
|
|
96
|
+
export const harnessStartConversationInputJsonSchema = JSONSchema.make(harnessStartConversationInputSchema, { target: "jsonSchema2020-12" });
|
|
97
|
+
/** JSON Schema advertised for the start-conversation result. */
|
|
98
|
+
export const harnessStartConversationResultJsonSchema = JSONSchema.make(harnessStartConversationResultSchema, { target: "jsonSchema2020-12" });
|
|
99
|
+
/** JSON Schema advertised for the MCP-local conversation search result. */
|
|
100
|
+
export const harnessSearchConversationsResultJsonSchema = JSONSchema.make(harnessSearchConversationsResultSchema, { target: "jsonSchema2020-12" });
|
|
30
101
|
/** JSON Schema advertised for the payload-only reply tool arguments. */
|
|
31
102
|
export const harnessReplyInputJsonSchema = JSONSchema.make(harnessReplyInputSchema, { target: "jsonSchema2020-12" });
|
|
32
103
|
/** JSON Schema advertised for the empty reply result. */
|
|
33
104
|
export const harnessReplyResultJsonSchema = JSONSchema.make(harnessReplyResultSchema, { target: "jsonSchema2020-12" });
|
|
105
|
+
/** JSON Schema advertised for registration arguments. */
|
|
106
|
+
export const harnessRegisterInputJsonSchema = JSONSchema.make(harnessRegisterInputSchema, { target: "jsonSchema2020-12" });
|
|
107
|
+
/** JSON Schema advertised for the registration result. */
|
|
108
|
+
export const harnessRegisterResultJsonSchema = JSONSchema.make(harnessRegisterResultSchema, { target: "jsonSchema2020-12" });
|
|
109
|
+
/** JSON Schema advertised for the empty status arguments. */
|
|
110
|
+
export const harnessStatusInputJsonSchema = JSONSchema.make(harnessStatusInputSchema, { target: "jsonSchema2020-12" });
|
|
111
|
+
/** JSON Schema advertised for the status result. */
|
|
112
|
+
export const harnessStatusResultJsonSchema = JSONSchema.make(harnessStatusResultSchema, { target: "jsonSchema2020-12" });
|
|
34
113
|
/**
|
|
35
114
|
* Strictly decode a turn event received from the MCP boundary.
|
|
36
115
|
* @param value Untrusted notification parameters.
|
|
37
116
|
* @returns The decoded nonempty protocol-message batch.
|
|
38
117
|
*/
|
|
39
118
|
export const decodeHarnessTurnEvent = (value) => decodeTurnEvent(value, strictDecodeOptions);
|
|
119
|
+
/**
|
|
120
|
+
* Strictly decode the membership-bearing conversation page received over MCP.
|
|
121
|
+
* @param value Untrusted structured tool content.
|
|
122
|
+
* @returns The decoded MCP-local conversation page.
|
|
123
|
+
*/
|
|
124
|
+
export const decodeHarnessSearchConversationsResult = (value) => decodeSearchConversationsResult(value, strictDecodeOptions);
|
|
125
|
+
/**
|
|
126
|
+
* Strictly decode a conversation created through the harness MCP boundary.
|
|
127
|
+
* @param value Untrusted structured tool content.
|
|
128
|
+
* @returns The created conversation with MCP-local membership.
|
|
129
|
+
*/
|
|
130
|
+
export const decodeHarnessStartConversationResult = (value) => decodeStartConversationResult(value, strictDecodeOptions);
|
|
131
|
+
/**
|
|
132
|
+
* Strictly decode the daemon status reported over the MCP boundary.
|
|
133
|
+
* @param value Untrusted structured tool content.
|
|
134
|
+
* @returns The decoded identity and connection state.
|
|
135
|
+
*/
|
|
136
|
+
export const decodeHarnessStatusResult = (value) => decodeStatusResult(value, strictDecodeOptions);
|
|
40
137
|
/**
|
|
41
138
|
* Build the private request metadata consumed by the production harness client.
|
|
42
139
|
* @param originatingConversationId Conversation associated with the live turn.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/harness/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/harness/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAElF,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAEhE,kEAAkE;AAClE,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEjE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,+BAA+B,GAC1C,sCAAsC,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAE5C,qDAAqD;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAE1D,uDAAuD;AACvD,MAAM,CAAC,MAAM,iCAAiC,GAAG,sBAAsB,CAAC;AAExE,0DAA0D;AAC1D,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAElE,oEAAoE;AACpE,MAAM,CAAC,MAAM,+BAA+B,GAAG,oBAAoB,CAAC;AAEpE,MAAM,aAAa,GACjB,qCAAqC,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC;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AAC;QACvC,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,gBAAgB,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,IAAsB,EACN,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC"}
|
package/dist/harness-client.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as KeyValueStore from "@effect/platform/KeyValueStore";
|
|
2
|
+
import { Context, Effect, Layer, Stream, type Scope } from "effect";
|
|
3
|
+
import { type AgentId, type AgentName } from "@moltzap/protocol/identity";
|
|
4
|
+
import { type EnrichedInboundMessage } from "./channel-core.js";
|
|
5
|
+
import { type ConversationWithParticipants } from "./harness/index.js";
|
|
6
|
+
/** MCP-local conversation projection including participant identities. */
|
|
7
|
+
export type { ConversationWithParticipants } from "./harness/index.js";
|
|
8
|
+
/** Existing adapter presentation with reply authority bound to its live turn. */
|
|
9
|
+
export interface HarnessTurn extends EnrichedInboundMessage {
|
|
10
10
|
/** Sends model output through the MCP reply route captured by this turn. */
|
|
11
11
|
readonly reply: (payload: string) => Effect.Effect<void, Error>;
|
|
12
12
|
}
|
|
13
13
|
/** Adapter-facing capability backed only by the daemon's loopback MCP surface. */
|
|
14
14
|
export interface HarnessClientService {
|
|
15
|
+
/** Active identity used by adapters when rendering self-authored context. */
|
|
16
|
+
readonly agentId: AgentId;
|
|
17
|
+
/** Creates a conversation with named peers and sends its initial content. */
|
|
18
|
+
readonly startConversation: (otherAgentNames: readonly AgentName[], initialContent: string) => Effect.Effect<ConversationWithParticipants, Error>;
|
|
15
19
|
/** The sole receive stream owned by this scoped client. */
|
|
16
20
|
readonly turns: Stream.Stream<HarnessTurn, Error>;
|
|
17
21
|
}
|
|
@@ -26,18 +30,18 @@ export interface HarnessClientOptions {
|
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Acquires one turn-ready harness connection and receive stream for the
|
|
29
|
-
* lifetime of the enclosing scope. The
|
|
33
|
+
* lifetime of the enclosing scope. The supplied KeyValueStore is local to the
|
|
34
|
+
* active agent and holds only stable presentation checkpoints.
|
|
30
35
|
*
|
|
31
36
|
* @param options Fixed loopback MCP endpoint.
|
|
32
37
|
* @returns The scoped adapter-facing service value.
|
|
33
38
|
*/
|
|
34
|
-
export declare const acquireHarnessClient: (options: HarnessClientOptions) => Effect.Effect<HarnessClientService, Error, Scope.Scope>;
|
|
39
|
+
export declare const acquireHarnessClient: (options: HarnessClientOptions) => Effect.Effect<HarnessClientService, Error, Scope.Scope | KeyValueStore.KeyValueStore>;
|
|
35
40
|
/**
|
|
36
41
|
* Builds the scoped runtime-adapter layer for one daemon endpoint.
|
|
37
42
|
*
|
|
38
43
|
* @param options Fixed loopback MCP endpoint.
|
|
39
44
|
* @returns A Layer providing the scoped HarnessClient capability.
|
|
40
45
|
*/
|
|
41
|
-
export declare const makeHarnessClientLayer: (options: HarnessClientOptions) => Layer.Layer<HarnessClient, Error>;
|
|
42
|
-
export {};
|
|
46
|
+
export declare const makeHarnessClientLayer: (options: HarnessClientOptions) => Layer.Layer<HarnessClient, Error, KeyValueStore.KeyValueStore>;
|
|
43
47
|
//# sourceMappingURL=harness-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-client.d.ts","sourceRoot":"","sources":["../src/harness-client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"harness-client.d.ts","sourceRoot":"","sources":["../src/harness-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MA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GAKG;AACH,eAAO,MAAM,sBAAsB,YACxB,oBAAoB,KAC5B,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,EAAE,aAAa,CAAC,aAAa,CACJ,CAAC"}
|
package/dist/harness-client.js
CHANGED
|
@@ -1,16 +1,71 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as KeyValueStore from "@effect/platform/KeyValueStore";
|
|
2
|
+
import { Context, Effect, Layer, Schema, Stream } from "effect";
|
|
3
|
+
import { agentsSearch, } from "@moltzap/protocol/identity";
|
|
4
|
+
import { messagesRead } from "@moltzap/protocol/message";
|
|
5
|
+
import { projectHarnessTurn, } from "./channel-core.js";
|
|
6
|
+
import { reconstructHarnessContext } from "./harness-context-projection.js";
|
|
7
|
+
import { acquireHarnessClientInternal, HARNESS_READ_CONVERSATION_TOOL, HARNESS_SEARCH_AGENTS_TOOL, HARNESS_SEARCH_CONVERSATIONS_TOOL, HARNESS_START_CONVERSATION_TOOL, HARNESS_STATUS_TOOL, decodeHarnessSearchConversationsResult, decodeHarnessStartConversationResult, decodeHarnessStatusResult, } from "./harness/index.js";
|
|
3
8
|
/** Effect service tag consumed by runtime adapters. */
|
|
4
9
|
export class HarnessClient extends Context.Tag("@moltzap/client/HarnessClient")() {
|
|
5
10
|
}
|
|
11
|
+
const strictDecodeOptions = { onExcessProperty: "error" };
|
|
12
|
+
const asError = (cause) => cause instanceof Error ? cause : new Error(String(cause));
|
|
13
|
+
const callDescriptorTool = (session, toolName, definition, params) => session
|
|
14
|
+
.callTool(toolName,
|
|
15
|
+
/* Safe because every RPC params Schema used here is a closed Struct and MCP tool arguments are JSON objects. */ params)
|
|
16
|
+
.pipe(Effect.flatMap((result) => Schema.decodeUnknown(definition.resultSchema)(result, strictDecodeOptions).pipe(Effect.map((decoded) =>
|
|
17
|
+
/* Safe because ResultOf derives from this exact descriptor's resultSchema; RpcDefinitionAny erases only the runtime schema property's generic surface. */ decoded))), Effect.mapError(asError));
|
|
18
|
+
const readActiveAgentId = (session) => session.callTool(HARNESS_STATUS_TOOL, {}).pipe(Effect.flatMap((result) => decodeHarnessStatusResult(result)), Effect.mapError(asError), Effect.flatMap((status) => {
|
|
19
|
+
if (status.agentId === undefined) {
|
|
20
|
+
// eslint-disable-next-line agent-code-guard/effect-error-erasure -- A daemon with no active identity is rejected at the public client boundary, whose existing error contract is Error.
|
|
21
|
+
return Effect.fail(new Error("Harness MCP status has no active AgentId"));
|
|
22
|
+
}
|
|
23
|
+
return Effect.succeed(status.agentId);
|
|
24
|
+
}));
|
|
25
|
+
const startConversation = (session, otherAgentNames, initialContent) => session
|
|
26
|
+
.callTool(HARNESS_START_CONVERSATION_TOOL, {
|
|
27
|
+
otherAgentNames,
|
|
28
|
+
initialContent,
|
|
29
|
+
})
|
|
30
|
+
.pipe(Effect.flatMap(decodeHarnessStartConversationResult), Effect.map(({ conversation }) => conversation), Effect.mapError(asError));
|
|
31
|
+
const searchConversations = (session, params) => session
|
|
32
|
+
.callTool(HARNESS_SEARCH_CONVERSATIONS_TOOL, params)
|
|
33
|
+
.pipe(Effect.flatMap(decodeHarnessSearchConversationsResult), Effect.mapError(asError));
|
|
34
|
+
const contextReadPlane = (session) => ({
|
|
35
|
+
searchAgents: (params) => callDescriptorTool(session, HARNESS_SEARCH_AGENTS_TOOL, agentsSearch, params),
|
|
36
|
+
searchConversations: (params) => searchConversations(session, params),
|
|
37
|
+
readConversation: (params) => callDescriptorTool(session, HARNESS_READ_CONVERSATION_TOOL, messagesRead, params),
|
|
38
|
+
});
|
|
39
|
+
const projectTurn = (session, checkpointStore, agentId, turn) => reconstructHarnessContext(contextReadPlane(session), turn.event).pipe(Effect.provideService(KeyValueStore.KeyValueStore, checkpointStore), Effect.map((context) => ({
|
|
40
|
+
...projectHarnessTurn({
|
|
41
|
+
agents: context.agents,
|
|
42
|
+
context: {
|
|
43
|
+
conversations: context.conversations,
|
|
44
|
+
crossConversationMessages: context.crossConversationMessages,
|
|
45
|
+
currentMessages: context.currentMessages,
|
|
46
|
+
},
|
|
47
|
+
ownAgentId: agentId,
|
|
48
|
+
}),
|
|
49
|
+
reply: turn.reply,
|
|
50
|
+
})), Effect.mapError(asError));
|
|
6
51
|
/**
|
|
7
52
|
* Acquires one turn-ready harness connection and receive stream for the
|
|
8
|
-
* lifetime of the enclosing scope. The
|
|
53
|
+
* lifetime of the enclosing scope. The supplied KeyValueStore is local to the
|
|
54
|
+
* active agent and holds only stable presentation checkpoints.
|
|
9
55
|
*
|
|
10
56
|
* @param options Fixed loopback MCP endpoint.
|
|
11
57
|
* @returns The scoped adapter-facing service value.
|
|
12
58
|
*/
|
|
13
|
-
export const acquireHarnessClient = (options) =>
|
|
59
|
+
export const acquireHarnessClient = (options) => Effect.gen(function* () {
|
|
60
|
+
const checkpointStore = yield* KeyValueStore.KeyValueStore;
|
|
61
|
+
const session = yield* acquireHarnessClientInternal(options);
|
|
62
|
+
const agentId = yield* readActiveAgentId(session);
|
|
63
|
+
return {
|
|
64
|
+
agentId,
|
|
65
|
+
startConversation: (otherAgentNames, initialContent) => startConversation(session, otherAgentNames, initialContent),
|
|
66
|
+
turns: session.turns.pipe(Stream.mapEffect((turn) => projectTurn(session, checkpointStore, agentId, turn))),
|
|
67
|
+
};
|
|
68
|
+
}).pipe(Effect.withSpan("acquireHarnessClient.presentation"));
|
|
14
69
|
/**
|
|
15
70
|
* Builds the scoped runtime-adapter layer for one daemon endpoint.
|
|
16
71
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness-client.js","sourceRoot":"","sources":["../src/harness-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"harness-client.js","sourceRoot":"","sources":["../src/harness-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAc,MAA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OAAO,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAClD,OAAO;QACL,OAAO;QACP,iBAAiB,EAAE,CACjB,eAAqC,EACrC,cAAsB,EACtB,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,cAAc,CAAC;QAChE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CACvB,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CACxB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,CACrD,CACF;KACF,CAAC;AACJ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAA6B,EACmC,EAAE,CAClE,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as KeyValueStore from "@effect/platform/KeyValueStore";
|
|
2
|
+
import type * as PlatformError from "@effect/platform/Error";
|
|
3
|
+
import { Effect, type ParseResult } from "effect";
|
|
4
|
+
import { conversationSearch, type ConversationId } from "@moltzap/protocol/conversation";
|
|
5
|
+
import { agentsSearch, type AgentCard } from "@moltzap/protocol/identity";
|
|
6
|
+
import { messagesRead, type Message } from "@moltzap/protocol/message";
|
|
7
|
+
import type { ParamsOf, ResultOf } from "@moltzap/protocol/rpc";
|
|
8
|
+
import type { ConversationWithParticipants, HarnessSearchConversationsResult, HarnessTurnEvent } from "./harness/runtime.js";
|
|
9
|
+
import { NonAdvancingCursorError } from "./pagination.js";
|
|
10
|
+
/** Package-private MCP read capabilities used for presentation recovery. */
|
|
11
|
+
export interface ContextProjectionReadPlane<E> {
|
|
12
|
+
readonly searchAgents: (params: ParamsOf<typeof agentsSearch>) => Effect.Effect<ResultOf<typeof agentsSearch>, E>;
|
|
13
|
+
readonly searchConversations: (params: ParamsOf<typeof conversationSearch>) => Effect.Effect<HarnessSearchConversationsResult, E>;
|
|
14
|
+
readonly readConversation: (params: ParamsOf<typeof messagesRead>) => Effect.Effect<ResultOf<typeof messagesRead>, E>;
|
|
15
|
+
}
|
|
16
|
+
/** Raw production context reconstructed for one live replyable observation. */
|
|
17
|
+
export interface ReconstructedHarnessContext {
|
|
18
|
+
readonly conversationId: ConversationId;
|
|
19
|
+
readonly agents: readonly AgentCard[];
|
|
20
|
+
readonly conversations: readonly ConversationWithParticipants[];
|
|
21
|
+
readonly currentMessages: HarnessTurnEvent["messages"];
|
|
22
|
+
readonly crossConversationMessages: readonly Message[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Reconstructs cross-conversation presentation deltas only when a live
|
|
26
|
+
* observation supplies current content and reply authority. The provided
|
|
27
|
+
* key-value store is scoped to one active agent; target ConversationIds key
|
|
28
|
+
* source-checkpoint maps within that scope.
|
|
29
|
+
*
|
|
30
|
+
* @param readPlane Typed MCP search and history readers.
|
|
31
|
+
* @param event Live production observation that permits one runtime turn.
|
|
32
|
+
* @returns Current and cross-conversation raw context for that observation.
|
|
33
|
+
*/
|
|
34
|
+
export declare const reconstructHarnessContext: <E>(readPlane: ContextProjectionReadPlane<E>, event: HarnessTurnEvent) => Effect.Effect<ReconstructedHarnessContext, E | NonAdvancingCursorError | PlatformError.PlatformError | ParseResult.ParseError, KeyValueStore.KeyValueStore>;
|
|
35
|
+
//# sourceMappingURL=harness-context-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-context-projection.d.ts","sourceRoot":"","sources":["../src/harness-context-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,KAAK,aAAa,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAkB,KAAK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