@finalai/agent-provider 0.9.0 → 0.11.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.
Files changed (206) hide show
  1. package/HOSTING.md +334 -245
  2. package/README.md +106 -20
  3. package/dist/modules/canonical-json.d.mts +4 -0
  4. package/dist/modules/canonical-json.mjs +33 -0
  5. package/dist/modules/canonical-json.mjs.map +7 -0
  6. package/dist/modules/channel.d.mts +51 -15
  7. package/dist/modules/channel.mjs +1 -0
  8. package/dist/modules/channel.mjs.map +2 -2
  9. package/dist/modules/code-host/host.d.mts +10 -0
  10. package/dist/modules/code-host/host.mjs +88 -0
  11. package/dist/modules/code-host/host.mjs.map +7 -0
  12. package/dist/modules/code-host/in-process.d.mts +24 -0
  13. package/dist/modules/code-host/in-process.mjs +89 -0
  14. package/dist/modules/code-host/in-process.mjs.map +7 -0
  15. package/dist/modules/code-host/index.d.mts +4 -0
  16. package/dist/modules/code-host/index.mjs +5 -0
  17. package/dist/modules/code-host/index.mjs.map +7 -0
  18. package/dist/modules/code-host/serverless.d.mts +63 -0
  19. package/dist/modules/code-host/serverless.mjs +27 -0
  20. package/dist/modules/code-host/serverless.mjs.map +7 -0
  21. package/dist/modules/code-host/types.d.mts +152 -0
  22. package/dist/modules/code-host/types.mjs +85 -0
  23. package/dist/modules/code-host/types.mjs.map +7 -0
  24. package/dist/modules/conformance/agent.mjs +72 -6
  25. package/dist/modules/conformance/agent.mjs.map +2 -2
  26. package/dist/modules/conformance/harness-kit.d.mts +9 -2
  27. package/dist/modules/conformance/harness-kit.mjs +224 -63
  28. package/dist/modules/conformance/harness-kit.mjs.map +3 -3
  29. package/dist/modules/conformance/local-harness.d.mts +1 -4
  30. package/dist/modules/conformance/local-harness.mjs +21 -22
  31. package/dist/modules/conformance/local-harness.mjs.map +2 -2
  32. package/dist/modules/conformance/protocol.d.mts +1 -0
  33. package/dist/modules/conformance/protocol.mjs +2 -0
  34. package/dist/modules/conformance/protocol.mjs.map +2 -2
  35. package/dist/modules/conformance/sandbox-kit.d.mts +12 -4
  36. package/dist/modules/conformance/sandbox-kit.mjs +189 -103
  37. package/dist/modules/conformance/sandbox-kit.mjs.map +2 -2
  38. package/dist/modules/conformance/scripted-model/chat-completions.mjs +1 -0
  39. package/dist/modules/conformance/scripted-model/chat-completions.mjs.map +2 -2
  40. package/dist/modules/conformance/scripted-model/directives.d.mts +3 -0
  41. package/dist/modules/conformance/scripted-model/directives.mjs +26 -10
  42. package/dist/modules/conformance/scripted-model/directives.mjs.map +2 -2
  43. package/dist/modules/conformance/scripted-model/messages.mjs +1 -0
  44. package/dist/modules/conformance/scripted-model/messages.mjs.map +2 -2
  45. package/dist/modules/conformance/scripted-model/responses.mjs +2 -0
  46. package/dist/modules/conformance/scripted-model/responses.mjs.map +2 -2
  47. package/dist/modules/conformance/stdio.d.mts +21 -0
  48. package/dist/modules/conformance/stdio.mjs +158 -0
  49. package/dist/modules/conformance/stdio.mjs.map +7 -0
  50. package/dist/modules/credential-routes.d.mts +3 -3
  51. package/dist/modules/credential-routes.mjs +2 -2
  52. package/dist/modules/credential-routes.mjs.map +2 -2
  53. package/dist/modules/document.d.mts +358 -0
  54. package/dist/modules/document.mjs +193 -0
  55. package/dist/modules/document.mjs.map +7 -0
  56. package/dist/modules/harness-configuration.d.mts +16 -0
  57. package/dist/modules/harness-configuration.mjs +83 -0
  58. package/dist/modules/harness-configuration.mjs.map +7 -0
  59. package/dist/modules/harness-definition.d.mts +280 -0
  60. package/dist/modules/harness-definition.mjs +430 -0
  61. package/dist/modules/harness-definition.mjs.map +7 -0
  62. package/dist/modules/harness-provider.d.mts +197 -0
  63. package/dist/modules/harness-provider.mjs +108 -0
  64. package/dist/modules/harness-provider.mjs.map +7 -0
  65. package/dist/modules/harness-requirements.d.mts +19 -0
  66. package/dist/modules/harness-requirements.mjs +40 -0
  67. package/dist/modules/harness-requirements.mjs.map +7 -0
  68. package/dist/modules/harness-start.d.mts +33 -0
  69. package/dist/modules/harness-start.mjs +107 -0
  70. package/dist/modules/harness-start.mjs.map +7 -0
  71. package/dist/modules/harness.d.mts +84 -109
  72. package/dist/modules/harness.mjs +56 -111
  73. package/dist/modules/harness.mjs.map +3 -3
  74. package/dist/modules/identity.d.mts +1 -0
  75. package/dist/modules/identity.mjs +2 -0
  76. package/dist/modules/identity.mjs.map +7 -0
  77. package/dist/modules/index.d.mts +12 -7
  78. package/dist/modules/index.mjs +12 -7
  79. package/dist/modules/index.mjs.map +2 -2
  80. package/dist/modules/inference.d.mts +35 -0
  81. package/dist/modules/inference.mjs +74 -0
  82. package/dist/modules/inference.mjs.map +7 -0
  83. package/dist/modules/local-channel-context.d.mts +1 -1
  84. package/dist/modules/local-channel-context.mjs +1 -1
  85. package/dist/modules/local-channel-context.mjs.map +2 -2
  86. package/dist/modules/requirements-check.d.mts +30 -0
  87. package/dist/modules/requirements-check.mjs +164 -0
  88. package/dist/modules/requirements-check.mjs.map +7 -0
  89. package/dist/modules/sandbox/client.d.mts +3 -0
  90. package/dist/modules/sandbox/client.mjs +101 -18
  91. package/dist/modules/sandbox/client.mjs.map +2 -2
  92. package/dist/modules/sandbox/grant.d.mts +78 -0
  93. package/dist/modules/sandbox/grant.mjs +134 -0
  94. package/dist/modules/sandbox/grant.mjs.map +7 -0
  95. package/dist/modules/sandbox/index.d.mts +3 -3
  96. package/dist/modules/sandbox/index.mjs +4 -5
  97. package/dist/modules/sandbox/index.mjs.map +2 -2
  98. package/dist/modules/sandbox/mcp-hosted.d.mts +1 -1
  99. package/dist/modules/sandbox/mcp-hosted.mjs +4 -7
  100. package/dist/modules/sandbox/mcp-hosted.mjs.map +2 -2
  101. package/dist/modules/sandbox/mcp.d.mts +4 -2
  102. package/dist/modules/sandbox/mcp.mjs +14 -7
  103. package/dist/modules/sandbox/mcp.mjs.map +2 -2
  104. package/dist/modules/sandbox/memory-sandbox.d.mts +2 -1
  105. package/dist/modules/sandbox/memory-sandbox.mjs +71 -41
  106. package/dist/modules/sandbox/memory-sandbox.mjs.map +2 -2
  107. package/dist/modules/sandbox/networking.d.mts +7 -7
  108. package/dist/modules/sandbox/networking.mjs +16 -9
  109. package/dist/modules/sandbox/networking.mjs.map +2 -2
  110. package/dist/modules/sandbox/remote/adapter.d.mts +30 -0
  111. package/dist/modules/sandbox/remote/adapter.mjs +381 -0
  112. package/dist/modules/sandbox/remote/adapter.mjs.map +7 -0
  113. package/dist/modules/sandbox/remote/body.d.mts +1 -0
  114. package/dist/modules/sandbox/remote/body.mjs +27 -0
  115. package/dist/modules/sandbox/remote/body.mjs.map +7 -0
  116. package/dist/modules/sandbox/remote/errors.d.mts +10 -0
  117. package/dist/modules/sandbox/remote/errors.mjs +62 -0
  118. package/dist/modules/sandbox/remote/errors.mjs.map +7 -0
  119. package/dist/modules/sandbox/remote/index.d.mts +5 -0
  120. package/dist/modules/sandbox/remote/index.mjs +6 -0
  121. package/dist/modules/sandbox/remote/index.mjs.map +7 -0
  122. package/dist/modules/sandbox/remote/ndjson.d.mts +6 -0
  123. package/dist/modules/sandbox/remote/ndjson.mjs +80 -0
  124. package/dist/modules/sandbox/remote/ndjson.mjs.map +7 -0
  125. package/dist/modules/sandbox/remote/platform-api.d.mts +8 -0
  126. package/dist/modules/sandbox/remote/platform-api.mjs +15 -0
  127. package/dist/modules/sandbox/remote/platform-api.mjs.map +7 -0
  128. package/dist/modules/sandbox/remote/preamble.d.mts +7 -0
  129. package/dist/modules/sandbox/remote/preamble.mjs +51 -0
  130. package/dist/modules/sandbox/remote/preamble.mjs.map +7 -0
  131. package/dist/modules/sandbox/remote/serve.d.mts +34 -0
  132. package/dist/modules/sandbox/remote/serve.mjs +520 -0
  133. package/dist/modules/sandbox/remote/serve.mjs.map +7 -0
  134. package/dist/modules/sandbox/remote/testing.d.mts +34 -0
  135. package/dist/modules/sandbox/remote/testing.mjs +275 -0
  136. package/dist/modules/sandbox/remote/testing.mjs.map +7 -0
  137. package/dist/modules/sandbox/seeds.d.mts +2 -2
  138. package/dist/modules/sandbox/seeds.mjs +2 -2
  139. package/dist/modules/sandbox/seeds.mjs.map +2 -2
  140. package/dist/modules/sandbox/server.d.mts +4 -6
  141. package/dist/modules/sandbox/server.mjs +93 -49
  142. package/dist/modules/sandbox/server.mjs.map +2 -2
  143. package/dist/modules/sandbox/setup/apply.d.mts +40 -0
  144. package/dist/modules/sandbox/setup/apply.mjs +190 -0
  145. package/dist/modules/sandbox/setup/apply.mjs.map +7 -0
  146. package/dist/modules/sandbox/setup/describe.d.mts +10 -0
  147. package/dist/modules/sandbox/setup/describe.mjs +62 -0
  148. package/dist/modules/sandbox/setup/describe.mjs.map +7 -0
  149. package/dist/modules/sandbox/setup/index.d.mts +6 -0
  150. package/dist/modules/sandbox/setup/index.mjs +17 -0
  151. package/dist/modules/sandbox/setup/index.mjs.map +7 -0
  152. package/dist/modules/sandbox/setup/paths.d.mts +8 -0
  153. package/dist/modules/sandbox/setup/paths.mjs +18 -0
  154. package/dist/modules/sandbox/setup/paths.mjs.map +7 -0
  155. package/dist/modules/sandbox/setup/schema.d.mts +43 -0
  156. package/dist/modules/sandbox/setup/schema.mjs +58 -0
  157. package/dist/modules/sandbox/setup/schema.mjs.map +7 -0
  158. package/dist/modules/sandbox/tool-policy.d.mts +1 -1
  159. package/dist/modules/sandbox/tool-policy.mjs +1 -1
  160. package/dist/modules/sandbox/tool-policy.mjs.map +2 -2
  161. package/dist/modules/sandbox/types.d.mts +117 -142
  162. package/dist/modules/sandbox/types.mjs +47 -57
  163. package/dist/modules/sandbox/types.mjs.map +3 -3
  164. package/dist/modules/sandbox/wire.d.mts +93 -6
  165. package/dist/modules/sandbox/wire.mjs +61 -38
  166. package/dist/modules/sandbox/wire.mjs.map +2 -2
  167. package/dist/modules/schemas.d.mts +5 -76
  168. package/dist/modules/schemas.mjs +18 -85
  169. package/dist/modules/schemas.mjs.map +2 -2
  170. package/dist/modules/tool-annotations.d.mts +15 -6
  171. package/dist/modules/tool-annotations.mjs +9 -3
  172. package/dist/modules/tool-annotations.mjs.map +2 -2
  173. package/dist/modules/tool-descriptor.d.mts +16 -0
  174. package/dist/modules/tool-descriptor.mjs +19 -0
  175. package/dist/modules/tool-descriptor.mjs.map +7 -0
  176. package/dist/modules/tool-patterns.d.mts +7 -7
  177. package/dist/modules/tool-patterns.mjs +10 -9
  178. package/dist/modules/tool-patterns.mjs.map +2 -2
  179. package/package.json +86 -41
  180. package/dist/modules/credentials.d.mts +0 -206
  181. package/dist/modules/credentials.mjs +0 -207
  182. package/dist/modules/credentials.mjs.map +0 -7
  183. package/dist/modules/dynamic.d.mts +0 -40
  184. package/dist/modules/dynamic.mjs +0 -79
  185. package/dist/modules/dynamic.mjs.map +0 -7
  186. package/dist/modules/hosted-bindings.d.mts +0 -15
  187. package/dist/modules/hosted-bindings.mjs +0 -21
  188. package/dist/modules/hosted-bindings.mjs.map +0 -7
  189. package/dist/modules/manifest.d.mts +0 -791
  190. package/dist/modules/manifest.mjs +0 -322
  191. package/dist/modules/manifest.mjs.map +0 -7
  192. package/dist/modules/provider-ref.d.mts +0 -29
  193. package/dist/modules/provider-ref.mjs +0 -55
  194. package/dist/modules/provider-ref.mjs.map +0 -7
  195. package/dist/modules/room-surface.d.mts +0 -355
  196. package/dist/modules/room-surface.mjs +0 -156
  197. package/dist/modules/room-surface.mjs.map +0 -7
  198. package/dist/modules/sandbox/open-scope-node.d.mts +0 -4
  199. package/dist/modules/sandbox/open-scope-node.mjs +0 -19
  200. package/dist/modules/sandbox/open-scope-node.mjs.map +0 -7
  201. package/dist/modules/sandbox/open-scope.d.mts +0 -16
  202. package/dist/modules/sandbox/open-scope.mjs +0 -66
  203. package/dist/modules/sandbox/open-scope.mjs.map +0 -7
  204. package/dist/modules/sandbox/workspace-identity.d.mts +0 -5
  205. package/dist/modules/sandbox/workspace-identity.mjs +0 -14
  206. package/dist/modules/sandbox/workspace-identity.mjs.map +0 -7
@@ -1,16 +1,17 @@
1
- import { CredentialDelivery, InferenceCredentialKind } from "../credentials.mjs";
1
+ import { InferenceSourceKind, PermissionLevel } from "@finalai/agent-protocol/agent-platform";
2
+ import { HarnessFeature } from "../document.mjs";
2
3
  import {
3
4
  AcpTransport,
5
+ CredentialDelivery,
4
6
  McpTransportKind,
5
7
  PromptWhileRunning
6
8
  } from "../harness.mjs";
7
- import { packageRef } from "../provider-ref.mjs";
9
+ import { harnessDefinitionSchema } from "../harness-definition.mjs";
8
10
  import { SCHEMA_IDS } from "../schemas.mjs";
9
11
  import { createConformanceAgent } from "./agent.mjs";
10
12
  import { createLinkedStreamPair } from "./fixtures.mjs";
11
- const LOCAL_CONFORMANCE_HARNESS_REF = packageRef(
12
- "@finalai/agent-provider/conformance/local"
13
- );
13
+ import { CONFORMANCE_HARNESS_NAME } from "./protocol.mjs";
14
+ const LOCAL_CONFORMANCE_HARNESS_NAME = CONFORMANCE_HARNESS_NAME;
14
15
  const MEMORY_URL_PREFIX = "memory://conformance/";
15
16
  const localConformanceHarness = (options = {}) => {
16
17
  const extensions = options.extensions ?? true;
@@ -27,24 +28,22 @@ const localConformanceHarness = (options = {}) => {
27
28
  const connections = /* @__PURE__ */ new Map();
28
29
  const parked = /* @__PURE__ */ new Set();
29
30
  const closed = /* @__PURE__ */ new Set();
30
- const description = {
31
- configSchema: {
31
+ const definition = harnessDefinitionSchema.parse({
32
+ configurationSchema: {
32
33
  type: "object",
33
- properties: { credentials: { $ref: SCHEMA_IDS.credentialPolicy } },
34
- additionalProperties: false
34
+ properties: {
35
+ inference: { $ref: SCHEMA_IDS.inference },
36
+ permissionMode: { $ref: SCHEMA_IDS.permissionMode }
37
+ }
35
38
  },
36
- acp: { transports: [AcpTransport.Ws], mcp: [McpTransportKind.Acp, McpTransportKind.Http] },
37
- baseTools: {},
38
- consumes: [],
39
- inference: {
40
- vendors: [],
41
- kinds: [InferenceCredentialKind.HarnessOwned],
42
- delivery: CredentialDelivery.PerRequest
43
- },
44
- supports: { observe: extensions, resumeReplay: true, fork: false, authorMeta: false },
39
+ features: [HarnessFeature.McpTools, HarnessFeature.SystemInstructions],
40
+ lowestPermission: PermissionLevel.Ask,
41
+ inference: { kinds: [InferenceSourceKind.Harness], delivery: CredentialDelivery.PerRequest },
42
+ mcp: [McpTransportKind.Acp, McpTransportKind.Http],
43
+ supports: { observe: extensions, resumeReplay: true, fork: extensions, authorMeta: extensions },
45
44
  promptWhileRunning,
46
45
  sessionSurvivesDisconnect
47
- };
46
+ });
48
47
  const endpointFor = (ref) => ({
49
48
  ref,
50
49
  transport: AcpTransport.Ws,
@@ -56,10 +55,10 @@ const localConformanceHarness = (options = {}) => {
56
55
  connections.delete(ref.harnessSessionRef);
57
56
  };
58
57
  const harness = {
59
- describe: async () => description,
58
+ definition,
60
59
  open: async () => {
61
60
  const ref = {
62
- harness: LOCAL_CONFORMANCE_HARNESS_REF,
61
+ harness: LOCAL_CONFORMANCE_HARNESS_NAME,
63
62
  harnessSessionRef: crypto.randomUUID(),
64
63
  generation: 0
65
64
  };
@@ -102,7 +101,7 @@ const localConformanceHarness = (options = {}) => {
102
101
  return { harness, dial, agent, nativeSessionId: async (id) => agent.nativeId(id) };
103
102
  };
104
103
  export {
105
- LOCAL_CONFORMANCE_HARNESS_REF,
104
+ LOCAL_CONFORMANCE_HARNESS_NAME,
106
105
  localConformanceHarness
107
106
  };
108
107
  //# sourceMappingURL=local-harness.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/conformance/local-harness.ts"],
4
- "sourcesContent": ["import type { AgentConnection, Stream } from '@agentclientprotocol/sdk/experimental/v2';\nimport type { FetchLike } from '@modelcontextprotocol/client';\nimport { CredentialDelivery, InferenceCredentialKind } from \"../credentials.mjs\";\nimport {\n AcpTransport,\n McpTransportKind,\n PromptWhileRunning,\n type HarnessDescriptionIface,\n type HarnessEndpointIface,\n type HarnessIface,\n type HarnessSessionRefIface,\n} from \"../harness.mjs\";\nimport { packageRef } from \"../provider-ref.mjs\";\nimport { SCHEMA_IDS } from \"../schemas.mjs\";\nimport { createConformanceAgent, type ConformanceAgentIface } from \"./agent.mjs\";\nimport { createLinkedStreamPair } from \"./fixtures.mjs\";\n\n// A HarnessIface that runs the reference conformance agent in-process over a\n// linked stream pair, so the kit tests itself in CI. Endpoints are\n// `memory://conformance/<harnessSessionRef>` WebSocket endpoints that only the\n// returned `dial` understands.\n\nexport const LOCAL_CONFORMANCE_HARNESS_REF = packageRef(\n '@finalai/agent-provider/conformance/local',\n);\nconst MEMORY_URL_PREFIX = 'memory://conformance/';\n\nexport interface LocalConformanceStreamIface extends Stream {\n close: () => void;\n}\n\nexport interface LocalConformanceHarnessIface {\n harness: HarnessIface;\n dial: (endpoint: HarnessEndpointIface) => Promise<LocalConformanceStreamIface>;\n agent: ConformanceAgentIface;\n nativeSessionId: (acpSessionId: string) => Promise<string | null>;\n}\n\nexport const localConformanceHarness = (\n options: {\n extensions?: boolean;\n fetch?: FetchLike;\n slowTurnMs?: number;\n privateMethods?: string[];\n // The hosting profile the reference program follows and the harness declares.\n promptWhileRunning?: PromptWhileRunning;\n sessionSurvivesDisconnect?: boolean;\n } = {},\n): LocalConformanceHarnessIface => {\n const extensions = options.extensions ?? true;\n const promptWhileRunning = options.promptWhileRunning ?? PromptWhileRunning.Queue;\n const sessionSurvivesDisconnect = options.sessionSurvivesDisconnect ?? false;\n const agent = createConformanceAgent({\n extensions,\n fetch: options.fetch,\n slowTurnMs: options.slowTurnMs,\n privateMethods: options.privateMethods,\n promptWhileRunning,\n survivesDisconnect: sessionSurvivesDisconnect,\n });\n const connections = new Map<string, Set<AgentConnection>>();\n const parked = new Set<string>();\n const closed = new Set<string>();\n\n const description: HarnessDescriptionIface = {\n configSchema: {\n type: 'object',\n properties: { credentials: { $ref: SCHEMA_IDS.credentialPolicy } },\n additionalProperties: false,\n },\n acp: { transports: [AcpTransport.Ws], mcp: [McpTransportKind.Acp, McpTransportKind.Http] },\n baseTools: {},\n consumes: [],\n inference: {\n vendors: [],\n kinds: [InferenceCredentialKind.HarnessOwned],\n delivery: CredentialDelivery.PerRequest,\n },\n supports: { observe: extensions, resumeReplay: true, fork: false, authorMeta: false },\n promptWhileRunning,\n sessionSurvivesDisconnect,\n };\n\n const endpointFor = (ref: HarnessSessionRefIface): HarnessEndpointIface => ({\n ref,\n transport: AcpTransport.Ws,\n url: `${MEMORY_URL_PREFIX}${ref.harnessSessionRef}`,\n headers: {},\n });\n\n const dropConnections = (ref: HarnessSessionRefIface) => {\n for (const connection of connections.get(ref.harnessSessionRef) ?? []) connection.close();\n connections.delete(ref.harnessSessionRef);\n };\n\n const harness: HarnessIface = {\n describe: async () => description,\n open: async () => {\n const ref: HarnessSessionRefIface = {\n harness: LOCAL_CONFORMANCE_HARNESS_REF,\n harnessSessionRef: crypto.randomUUID(),\n generation: 0,\n };\n return endpointFor(ref);\n },\n resume: async (args) => {\n if (closed.has(args.ref.harnessSessionRef)) throw new Error('harness session was closed');\n parked.delete(args.ref.harnessSessionRef);\n return endpointFor(args.ref);\n },\n park: async (ref) => {\n parked.add(ref.harnessSessionRef);\n dropConnections(ref);\n },\n close: async (ref) => {\n closed.add(ref.harnessSessionRef);\n dropConnections(ref);\n },\n health: async (ref) => ({\n ok: !closed.has(ref.harnessSessionRef),\n detail: parked.has(ref.harnessSessionRef) ? 'parked' : undefined,\n checkedAt: new Date().toISOString(),\n }),\n };\n\n const dial = async (endpoint: HarnessEndpointIface): Promise<LocalConformanceStreamIface> => {\n if (endpoint.transport !== AcpTransport.Ws || !endpoint.url.startsWith(MEMORY_URL_PREFIX)) {\n throw new Error('the local conformance harness only dials its own memory:// endpoints');\n }\n const key = endpoint.url.slice(MEMORY_URL_PREFIX.length);\n if (closed.has(key)) throw new Error('harness session was closed');\n if (parked.has(key)) throw new Error('harness session is parked; resume it first');\n const [agentSide, clientSide] = createLinkedStreamPair();\n const connection = agent.connect(agentSide);\n const set = connections.get(key) ?? new Set<AgentConnection>();\n set.add(connection);\n connections.set(key, set);\n void connection.closed.then(() => set.delete(connection));\n // Hanging up reaches the agent, as closing a WebSocket would.\n return { ...clientSide, close: () => connection.close() };\n };\n\n return { harness, dial, agent, nativeSessionId: async (id) => agent.nativeId(id) };\n};\n"],
5
- "mappings": "AAEA,SAAS,oBAAoB,+BAA+B;AAC5D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,8BAA0D;AACnE,SAAS,8BAA8B;AAOhC,MAAM,gCAAgC;AAAA,EAC3C;AACF;AACA,MAAM,oBAAoB;AAanB,MAAM,0BAA0B,CACrC,UAQI,CAAC,MAC4B;AACjC,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,qBAAqB,QAAQ,sBAAsB,mBAAmB;AAC5E,QAAM,4BAA4B,QAAQ,6BAA6B;AACvE,QAAM,QAAQ,uBAAuB;AAAA,IACnC;AAAA,IACA,OAAO,QAAQ;AAAA,IACf,YAAY,QAAQ;AAAA,IACpB,gBAAgB,QAAQ;AAAA,IACxB;AAAA,IACA,oBAAoB;AAAA,EACtB,CAAC;AACD,QAAM,cAAc,oBAAI,IAAkC;AAC1D,QAAM,SAAS,oBAAI,IAAY;AAC/B,QAAM,SAAS,oBAAI,IAAY;AAE/B,QAAM,cAAuC;AAAA,IAC3C,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,iBAAiB,EAAE;AAAA,MACjE,sBAAsB;AAAA,IACxB;AAAA,IACA,KAAK,EAAE,YAAY,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,iBAAiB,KAAK,iBAAiB,IAAI,EAAE;AAAA,IACzF,WAAW,CAAC;AAAA,IACZ,UAAU,CAAC;AAAA,IACX,WAAW;AAAA,MACT,SAAS,CAAC;AAAA,MACV,OAAO,CAAC,wBAAwB,YAAY;AAAA,MAC5C,UAAU,mBAAmB;AAAA,IAC/B;AAAA,IACA,UAAU,EAAE,SAAS,YAAY,cAAc,MAAM,MAAM,OAAO,YAAY,MAAM;AAA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;AACzF,YAAM,IAAI,MAAM,sEAAsE;AAAA,IACxF;AACA,UAAM,MAAM,SAAS,IAAI,MAAM,kBAAkB,MAAM;AACvD,QAAI,OAAO,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,4BAA4B;AACjE,QAAI,OAAO,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,4CAA4C;AACjF,UAAM,CAAC,WAAW,UAAU,IAAI,uBAAuB;AACvD,UAAM,aAAa,MAAM,QAAQ,SAAS;AAC1C,UAAM,MAAM,YAAY,IAAI,GAAG,KAAK,oBAAI,IAAqB;AAC7D,QAAI,IAAI,UAAU;AAClB,gBAAY,IAAI,KAAK,GAAG;AACxB,SAAK,WAAW,OAAO,KAAK,MAAM,IAAI,OAAO,UAAU,CAAC;AAExD,WAAO,EAAE,GAAG,YAAY,OAAO,MAAM,WAAW,MAAM,EAAE;AAAA,EAC1D;AAEA,SAAO,EAAE,SAAS,MAAM,OAAO,iBAAiB,OAAO,OAAO,MAAM,SAAS,EAAE,EAAE;AACnF;",
4
+ "sourcesContent": ["import type { AgentConnection, Stream } from '@agentclientprotocol/sdk/experimental/v2';\nimport type { FetchLike } from '@modelcontextprotocol/client';\nimport { InferenceSourceKind, PermissionLevel } from '@finalai/agent-protocol/agent-platform';\nimport { HarnessFeature } from \"../document.mjs\";\nimport {\n AcpTransport,\n CredentialDelivery,\n McpTransportKind,\n PromptWhileRunning,\n type HarnessEndpointIface,\n type HarnessIface,\n type HarnessSessionRefIface,\n} from \"../harness.mjs\";\nimport { harnessDefinitionSchema } from \"../harness-definition.mjs\";\nimport { SCHEMA_IDS } from \"../schemas.mjs\";\nimport { createConformanceAgent, type ConformanceAgentIface } from \"./agent.mjs\";\nimport { createLinkedStreamPair } from \"./fixtures.mjs\";\nimport { CONFORMANCE_HARNESS_NAME } from \"./protocol.mjs\";\n\n// A HarnessIface that runs the reference conformance agent in-process over a\n// linked stream pair, so the kit tests itself in CI. Endpoints are\n// `memory://conformance/<harnessSessionRef>` WebSocket endpoints that only the\n// returned `dial` understands.\n\nexport const LOCAL_CONFORMANCE_HARNESS_NAME = CONFORMANCE_HARNESS_NAME;\n\nconst MEMORY_URL_PREFIX = 'memory://conformance/';\n\nexport interface LocalConformanceStreamIface extends Stream {\n close: () => void;\n}\n\nexport interface LocalConformanceHarnessIface {\n harness: HarnessIface;\n dial: (endpoint: HarnessEndpointIface) => Promise<LocalConformanceStreamIface>;\n agent: ConformanceAgentIface;\n nativeSessionId: (acpSessionId: string) => Promise<string | null>;\n}\n\nexport const localConformanceHarness = (\n options: {\n extensions?: boolean;\n fetch?: FetchLike;\n slowTurnMs?: number;\n privateMethods?: string[];\n // The hosting profile the reference program follows and the harness declares.\n promptWhileRunning?: PromptWhileRunning;\n sessionSurvivesDisconnect?: boolean;\n } = {},\n): LocalConformanceHarnessIface => {\n const extensions = options.extensions ?? true;\n const promptWhileRunning = options.promptWhileRunning ?? PromptWhileRunning.Queue;\n const sessionSurvivesDisconnect = options.sessionSurvivesDisconnect ?? false;\n const agent = createConformanceAgent({\n extensions,\n fetch: options.fetch,\n slowTurnMs: options.slowTurnMs,\n privateMethods: options.privateMethods,\n promptWhileRunning,\n survivesDisconnect: sessionSurvivesDisconnect,\n });\n const connections = new Map<string, Set<AgentConnection>>();\n const parked = new Set<string>();\n const closed = new Set<string>();\n\n // An agent that speaks ACP v2 itself, reached in-process.\n const definition = harnessDefinitionSchema.parse({\n configurationSchema: {\n type: 'object',\n properties: {\n inference: { $ref: SCHEMA_IDS.inference },\n permissionMode: { $ref: SCHEMA_IDS.permissionMode },\n },\n },\n features: [HarnessFeature.McpTools, HarnessFeature.SystemInstructions],\n lowestPermission: PermissionLevel.Ask,\n inference: { kinds: [InferenceSourceKind.Harness], delivery: CredentialDelivery.PerRequest },\n mcp: [McpTransportKind.Acp, McpTransportKind.Http],\n supports: { observe: extensions, resumeReplay: true, fork: extensions, authorMeta: extensions },\n promptWhileRunning,\n sessionSurvivesDisconnect,\n });\n\n const endpointFor = (ref: HarnessSessionRefIface): HarnessEndpointIface => ({\n ref,\n transport: AcpTransport.Ws,\n url: `${MEMORY_URL_PREFIX}${ref.harnessSessionRef}`,\n headers: {},\n });\n\n const dropConnections = (ref: HarnessSessionRefIface) => {\n for (const connection of connections.get(ref.harnessSessionRef) ?? []) connection.close();\n connections.delete(ref.harnessSessionRef);\n };\n\n const harness: HarnessIface = {\n definition,\n open: async () => {\n const ref: HarnessSessionRefIface = {\n harness: LOCAL_CONFORMANCE_HARNESS_NAME,\n harnessSessionRef: crypto.randomUUID(),\n generation: 0,\n };\n return endpointFor(ref);\n },\n resume: async (args) => {\n if (closed.has(args.ref.harnessSessionRef)) throw new Error('harness session was closed');\n parked.delete(args.ref.harnessSessionRef);\n return endpointFor(args.ref);\n },\n park: async (ref) => {\n parked.add(ref.harnessSessionRef);\n dropConnections(ref);\n },\n close: async (ref) => {\n closed.add(ref.harnessSessionRef);\n dropConnections(ref);\n },\n health: async (ref) => ({\n ok: !closed.has(ref.harnessSessionRef),\n detail: parked.has(ref.harnessSessionRef) ? 'parked' : undefined,\n checkedAt: new Date().toISOString(),\n }),\n };\n\n const dial = async (endpoint: HarnessEndpointIface): Promise<LocalConformanceStreamIface> => {\n if (endpoint.transport !== AcpTransport.Ws || !endpoint.url.startsWith(MEMORY_URL_PREFIX)) {\n throw new Error('the local conformance harness only dials its own memory:// endpoints');\n }\n const key = endpoint.url.slice(MEMORY_URL_PREFIX.length);\n if (closed.has(key)) throw new Error('harness session was closed');\n if (parked.has(key)) throw new Error('harness session is parked; resume it first');\n const [agentSide, clientSide] = createLinkedStreamPair();\n const connection = agent.connect(agentSide);\n const set = connections.get(key) ?? new Set<AgentConnection>();\n set.add(connection);\n connections.set(key, set);\n void connection.closed.then(() => set.delete(connection));\n // Hanging up reaches the agent, as closing a WebSocket would.\n return { ...clientSide, close: () => connection.close() };\n };\n\n return { harness, dial, agent, nativeSessionId: async (id) => agent.nativeId(id) };\n};\n"],
5
+ "mappings": "AAEA,SAAS,qBAAqB,u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,QAAI,OAAO,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,4BAA4B;AACjE,QAAI,OAAO,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,4CAA4C;AACjF,UAAM,CAAC,WAAW,UAAU,IAAI,uBAAuB;AACvD,UAAM,aAAa,MAAM,QAAQ,SAAS;AAC1C,UAAM,MAAM,YAAY,IAAI,GAAG,KAAK,oBAAI,IAAqB;AAC7D,QAAI,IAAI,UAAU;AAClB,gBAAY,IAAI,KAAK,GAAG;AACxB,SAAK,WAAW,OAAO,KAAK,MAAM,IAAI,OAAO,UAAU,CAAC;AAExD,WAAO,EAAE,GAAG,YAAY,OAAO,MAAM,WAAW,MAAM,EAAE;AAAA,EAC1D;AAEA,SAAO,EAAE,SAAS,MAAM,OAAO,iBAAiB,OAAO,OAAO,MAAM,SAAS,EAAE,EAAE;AACnF;",
6
6
  "names": []
7
7
  }
@@ -28,3 +28,4 @@ export declare const OBSERVE_METHOD = "_final/session/observe";
28
28
  export declare const FINAL_META_KEY = "final.ai";
29
29
  export { CONFORMANCE_BIG_IMAGE_BYTES } from "./image.mjs";
30
30
  export declare const conformanceEchoText: (nonce: string, text: string) => string;
31
+ export declare const CONFORMANCE_HARNESS_NAME = "conformance-local";
@@ -35,6 +35,7 @@ const OBSERVE_METHOD = "_final/session/observe";
35
35
  const FINAL_META_KEY = "final.ai";
36
36
  import { CONFORMANCE_BIG_IMAGE_BYTES } from "./image.mjs";
37
37
  const conformanceEchoText = (nonce, text) => `mcp-echo:${nonce}:${text}`;
38
+ const CONFORMANCE_HARNESS_NAME = "conformance-local";
38
39
  export {
39
40
  AFTER_SEQ_REPLAY_TYPE,
40
41
  CONFORMANCE_ACP_SERVER_ID,
@@ -44,6 +45,7 @@ export {
44
45
  CONFORMANCE_DIRECTIVE_PREFIX,
45
46
  CONFORMANCE_ELICITATION_ANSWER,
46
47
  CONFORMANCE_ELICIT_TOOL,
48
+ CONFORMANCE_HARNESS_NAME,
47
49
  CONFORMANCE_HTTP_SERVER_NAME,
48
50
  CONFORMANCE_MCP_TOOL,
49
51
  ConformanceDirective,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/conformance/protocol.ts"],
4
- "sourcesContent": ["// The scripted test protocol the harness conformance kit drives a harness\n// with. The kit sends prompts whose first text block is a directive; a harness\n// under test must route these to a program that implements them (the\n// reference program is `createConformanceAgent()`; a real harness runs the kit\n// against a conformance build or mode of its own program).\n//\n// conformance:echo <text>\n// Stream <text> as agent_message_chunk updates (any chunking), then end the\n// turn with state_update idle, stopReason end_turn.\n// conformance:permission\n// Send session/request_permission with at least one allow_once option,\n// then reply with the text `permission:<kind of the selected option>`\n// (`permission:cancelled` if cancelled) and end the turn.\n// conformance:elicit\n// Send elicitation/create in form mode with a required string property\n// `answer`, then reply `elicitation:<action>:<answer>` and end the turn.\n// conformance:slow\n// Stream `slow:started`, then keep the turn running until session/cancel\n// arrives and end it with stopReason cancelled.\n// conformance:error\n// End the turn with stopReason error.\n// conformance:mcp <server name> <tool> [JSON arguments]\n// Call <tool> on the session's MCP server named <server name> (over\n// `mcp/message` for an `acp` server, Streamable HTTP for an `http` one) and\n// reply `mcp:<text of the tool result>` (`mcp-error:<message>` on failure).\n// conformance:history\n// Reply with every user text the session has seen, prompts and\n// `_final/session/observe` content alike, one per line, in order.\n// conformance:wait <ms>\n// Stream `wait:started`, keep the turn running for <ms> milliseconds, stream\n// `wait:done` and end the turn (stopReason cancelled when cancelled first).\n// A prompt accepted meanwhile follows the harness's `promptWhileRunning`:\n// `inject` handles it inside this turn (one idle ends both), `queue` echoes\n// and runs it after this turn's idle.\n// conformance:clear\n// Start a fresh native conversation under the same ACP session (what\n// `/clear` does in Claude Code), reply `cleared` and end the turn. The ACP\n// session id stays the same; resuming it keeps working.\n// conformance:big <bytes>\n// Run one tool call whose result is <bytes> bytes of text plus a valid 300+ KiB\n// PNG image, then reply `big:done` and end the turn. A Final program keeps\n// every frame within the frame rule by moving both to\n// `resource_link` blocks.\n//\n// Every accepted prompt is echoed as a `user_message` (or chunk) carrying the\n// prompt response's `messageId`. A harness that declares\n// `sessionSurvivesDisconnect` keeps running work and open requests across a\n// dropped connection and re-raises open requests with the same JSON-RPC ids\n// on the next `session/resume`.\n//\n// Replay: `session/resume` with `replayFrom: {type: 'start'}` re-sends every\n// session/update of the session; with `{type: '_final/after_seq', seq: N}`\n// (final profile) every update after the first N session/update\n// notifications the client received for the session.\n\nexport const CONFORMANCE_DIRECTIVE_PREFIX = 'conformance:';\n\nexport enum ConformanceDirective {\n Echo = 'echo',\n Permission = 'permission',\n Elicit = 'elicit',\n Slow = 'slow',\n Error = 'error',\n Mcp = 'mcp',\n History = 'history',\n Wait = 'wait',\n Clear = 'clear',\n Big = 'big',\n}\n\nexport const directive = (name: ConformanceDirective, rest = ''): string =>\n `${CONFORMANCE_DIRECTIVE_PREFIX}${name}${rest === '' ? '' : ` ${rest}`}`;\n\nexport const parseDirective = (\n text: string,\n): { name: ConformanceDirective; rest: string } | null => {\n const trimmed = text.trim();\n if (!trimmed.startsWith(CONFORMANCE_DIRECTIVE_PREFIX)) return null;\n const body = trimmed.slice(CONFORMANCE_DIRECTIVE_PREFIX.length);\n const space = body.indexOf(' ');\n const head = space < 0 ? body : body.slice(0, space);\n const rest = space < 0 ? '' : body.slice(space + 1);\n const name = Object.values(ConformanceDirective).find((value) => value === head);\n return name == null ? null : { name, rest };\n};\n\nexport const CONFORMANCE_ELICITATION_ANSWER = 'conformance-answer';\nexport const CONFORMANCE_MCP_TOOL = 'echo';\nexport const CONFORMANCE_BIG_TOOL = 'large_result';\nexport const CONFORMANCE_ELICIT_TOOL = 'ask_answer';\nexport const CONFORMANCE_ACP_SERVER_NAME = 'conformance_acp';\nexport const CONFORMANCE_HTTP_SERVER_NAME = 'conformance_http';\nexport const CONFORMANCE_ACP_SERVER_ID = 'conformance-acp';\nexport const AFTER_SEQ_REPLAY_TYPE = '_final/after_seq';\nexport const OBSERVE_METHOD = '_final/session/observe';\nexport const FINAL_META_KEY = 'final.ai';\n// The image `conformance:big` attaches.\nexport { CONFORMANCE_BIG_IMAGE_BYTES } from \"./image.mjs\";\n\n// The MCP fixture's echo result text.\nexport const conformanceEchoText = (nonce: string, text: string): string =>\n `mcp-echo:${nonce}:${text}`;\n"],
5
- "mappings": "AAuDO,MAAM,+BAA+B;AAErC,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,gBAAa;AACb,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,WAAQ;AACR,EAAAA,sBAAA,SAAM;AACN,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,WAAQ;AACR,EAAAA,sBAAA,SAAM;AAVI,SAAAA;AAAA,GAAA;AAaL,MAAM,YAAY,CAAC,MAA4B,OAAO,OAC3D,GAAG,4BAA4B,GAAG,IAAI,GAAG,SAAS,KAAK,KAAK,IAAI,IAAI,EAAE;AAEjE,MAAM,iBAAiB,CAC5B,SACwD;AACxD,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,CAAC,QAAQ,WAAW,4BAA4B,EAAG,QAAO;AAC9D,QAAM,OAAO,QAAQ,MAAM,6BAA6B,MAAM;AAC9D,QAAM,QAAQ,KAAK,QAAQ,GAAG;AAC9B,QAAM,OAAO,QAAQ,IAAI,OAAO,KAAK,MAAM,GAAG,KAAK;AACnD,QAAM,OAAO,QAAQ,IAAI,KAAK,KAAK,MAAM,QAAQ,CAAC;AAClD,QAAM,OAAO,OAAO,OAAO,oBAAoB,EAAE,KAAK,CAAC,UAAU,UAAU,IAAI;AAC/E,SAAO,QAAQ,OAAO,OAAO,EAAE,MAAM,KAAK;AAC5C;AAEO,MAAM,iCAAiC;AACvC,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,8BAA8B;AACpC,MAAM,+BAA+B;AACrC,MAAM,4BAA4B;AAClC,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAE9B,SAAS,mCAAmC;AAGrC,MAAM,sBAAsB,CAAC,OAAe,SACjD,YAAY,KAAK,IAAI,IAAI;",
4
+ "sourcesContent": ["// The scripted test protocol the harness conformance kit drives a harness\n// with. The kit sends prompts whose first text block is a directive; a harness\n// under test must route these to a program that implements them (the\n// reference program is `createConformanceAgent()`; a real harness runs the kit\n// against a conformance build or mode of its own program).\n//\n// conformance:echo <text>\n// Stream <text> as agent_message_chunk updates (any chunking), then end the\n// turn with state_update idle, stopReason end_turn.\n// conformance:permission\n// Send session/request_permission with at least one allow_once option,\n// then reply with the text `permission:<kind of the selected option>`\n// (`permission:cancelled` if cancelled) and end the turn.\n// conformance:elicit\n// Send elicitation/create in form mode with a required string property\n// `answer`, then reply `elicitation:<action>:<answer>` and end the turn.\n// conformance:slow\n// Stream `slow:started`, then keep the turn running until session/cancel\n// arrives and end it with stopReason cancelled.\n// conformance:error\n// End the turn with stopReason error.\n// conformance:mcp <server name> <tool> [JSON arguments]\n// Call <tool> on the session's MCP server named <server name> (over\n// `mcp/message` for an `acp` server, Streamable HTTP for an `http` one) and\n// reply `mcp:<text of the tool result>` (`mcp-error:<message>` on failure).\n// conformance:history\n// Reply with every user text the session has seen, prompts and\n// `_final/session/observe` content alike, one per line, in order.\n// conformance:wait <ms>\n// Stream `wait:started`, keep the turn running for <ms> milliseconds, stream\n// `wait:done` and end the turn (stopReason cancelled when cancelled first).\n// A prompt accepted meanwhile follows the harness's `promptWhileRunning`:\n// `inject` handles it inside this turn (one idle ends both), `queue` echoes\n// and runs it after this turn's idle.\n// conformance:clear\n// Start a fresh native conversation under the same ACP session (what\n// `/clear` does in Claude Code), reply `cleared` and end the turn. The ACP\n// session id stays the same; resuming it keeps working.\n// conformance:big <bytes>\n// Run one tool call whose result is <bytes> bytes of text plus a valid 300+ KiB\n// PNG image, then reply `big:done` and end the turn. A Final program keeps\n// every frame within the frame rule by moving both to\n// `resource_link` blocks.\n//\n// Every accepted prompt is echoed as a `user_message` (or chunk) carrying the\n// prompt response's `messageId`. A harness that declares\n// `sessionSurvivesDisconnect` keeps running work and open requests across a\n// dropped connection and re-raises open requests with the same JSON-RPC ids\n// on the next `session/resume`.\n//\n// Replay: `session/resume` with `replayFrom: {type: 'start'}` re-sends every\n// session/update of the session; with `{type: '_final/after_seq', seq: N}`\n// (final profile) every update after the first N session/update\n// notifications the client received for the session.\n\nexport const CONFORMANCE_DIRECTIVE_PREFIX = 'conformance:';\n\nexport enum ConformanceDirective {\n Echo = 'echo',\n Permission = 'permission',\n Elicit = 'elicit',\n Slow = 'slow',\n Error = 'error',\n Mcp = 'mcp',\n History = 'history',\n Wait = 'wait',\n Clear = 'clear',\n Big = 'big',\n}\n\nexport const directive = (name: ConformanceDirective, rest = ''): string =>\n `${CONFORMANCE_DIRECTIVE_PREFIX}${name}${rest === '' ? '' : ` ${rest}`}`;\n\nexport const parseDirective = (\n text: string,\n): { name: ConformanceDirective; rest: string } | null => {\n const trimmed = text.trim();\n if (!trimmed.startsWith(CONFORMANCE_DIRECTIVE_PREFIX)) return null;\n const body = trimmed.slice(CONFORMANCE_DIRECTIVE_PREFIX.length);\n const space = body.indexOf(' ');\n const head = space < 0 ? body : body.slice(0, space);\n const rest = space < 0 ? '' : body.slice(space + 1);\n const name = Object.values(ConformanceDirective).find((value) => value === head);\n return name == null ? null : { name, rest };\n};\n\nexport const CONFORMANCE_ELICITATION_ANSWER = 'conformance-answer';\nexport const CONFORMANCE_MCP_TOOL = 'echo';\nexport const CONFORMANCE_BIG_TOOL = 'large_result';\nexport const CONFORMANCE_ELICIT_TOOL = 'ask_answer';\nexport const CONFORMANCE_ACP_SERVER_NAME = 'conformance_acp';\nexport const CONFORMANCE_HTTP_SERVER_NAME = 'conformance_http';\nexport const CONFORMANCE_ACP_SERVER_ID = 'conformance-acp';\nexport const AFTER_SEQ_REPLAY_TYPE = '_final/after_seq';\nexport const OBSERVE_METHOD = '_final/session/observe';\nexport const FINAL_META_KEY = 'final.ai';\n// The image `conformance:big` attaches.\nexport { CONFORMANCE_BIG_IMAGE_BYTES } from \"./image.mjs\";\n\n// The MCP fixture's echo result text.\nexport const conformanceEchoText = (nonce: string, text: string): string =>\n `mcp-echo:${nonce}:${text}`;\n\n// The harness name conformanceOpenArgs puts in its settings; the local\n// reference harness answers to it.\nexport const CONFORMANCE_HARNESS_NAME = 'conformance-local';\n"],
5
+ "mappings": "AAuDO,MAAM,+BAA+B;AAErC,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,gBAAa;AACb,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,WAAQ;AACR,EAAAA,sBAAA,SAAM;AACN,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,WAAQ;AACR,EAAAA,sBAAA,SAAM;AAVI,SAAAA;AAAA,GAAA;AAaL,MAAM,YAAY,CAAC,MAA4B,OAAO,OAC3D,GAAG,4BAA4B,GAAG,IAAI,GAAG,SAAS,KAAK,KAAK,IAAI,IAAI,EAAE;AAEjE,MAAM,iBAAiB,CAC5B,SACwD;AACxD,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,CAAC,QAAQ,WAAW,4BAA4B,EAAG,QAAO;AAC9D,QAAM,OAAO,QAAQ,MAAM,6BAA6B,MAAM;AAC9D,QAAM,QAAQ,KAAK,QAAQ,GAAG;AAC9B,QAAM,OAAO,QAAQ,IAAI,OAAO,KAAK,MAAM,GAAG,KAAK;AACnD,QAAM,OAAO,QAAQ,IAAI,KAAK,KAAK,MAAM,QAAQ,CAAC;AAClD,QAAM,OAAO,OAAO,OAAO,oBAAoB,EAAE,KAAK,CAAC,UAAU,UAAU,IAAI;AAC/E,SAAO,QAAQ,OAAO,OAAO,EAAE,MAAM,KAAK;AAC5C;AAEO,MAAM,iCAAiC;AACvC,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,8BAA8B;AACpC,MAAM,+BAA+B;AACrC,MAAM,4BAA4B;AAClC,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAE9B,SAAS,mCAAmC;AAGrC,MAAM,sBAAsB,CAAC,OAAe,SACjD,YAAY,KAAK,IAAI,IAAI;AAIpB,MAAM,2BAA2B;",
6
6
  "names": ["ConformanceDirective"]
7
7
  }
@@ -1,17 +1,25 @@
1
1
  import type { JsonValue } from "../json.mjs";
2
- import { type AnySandboxProviderIface, type NetworkSandboxSessionIface, type SandboxPrepareContextIface, type SandboxStartContextIface } from "../sandbox/types.mjs";
2
+ import { type AnySandboxProviderIface, type NetworkSandboxSessionIface, type SandboxPrepareContextIface, type SandboxResourceContextIface } from "../sandbox/types.mjs";
3
+ import { type SandboxProviderDiscoveryInputIface } from "../sandbox/remote/index.mjs";
3
4
  import { type ConformanceCaseResultIface } from "./harness-kit.mjs";
4
5
  export interface RunSandboxConformanceArgsIface {
5
6
  handle?: NetworkSandboxSessionIface;
6
7
  provider?: AnySandboxProviderIface;
7
8
  environmentOptions?: JsonValue;
8
- openOptions?: JsonValue;
9
9
  prepareContext?: Partial<SandboxPrepareContextIface>;
10
- startContext?: Partial<SandboxStartContextIface>;
10
+ resourceContext?: Partial<SandboxResourceContextIface>;
11
11
  viaWire?: boolean;
12
12
  largeFileBytes?: number;
13
13
  timeoutMs?: number;
14
14
  platform?: SandboxPlatformConformanceIface;
15
+ remote?: {
16
+ discovery?: Partial<SandboxProviderDiscoveryInputIface>;
17
+ downstreamToken?: (args: {
18
+ audience: string;
19
+ userId: string | null;
20
+ }) => string;
21
+ forwardedSecrets?: Record<string, string>;
22
+ };
15
23
  }
16
24
  export interface SandboxPlatformConformanceIface {
17
25
  environmentOptions(args: {
@@ -25,4 +33,4 @@ export interface SandboxConformanceReportIface {
25
33
  cases: ConformanceCaseResultIface[];
26
34
  }
27
35
  export declare const DURABLE_CONFORMANCE_SCRIPT = "echo one; echo err-one >&2; sleep 2; echo two; echo err-two >&2; exit 7";
28
- export declare const runSandboxConformance: (args: RunSandboxConformanceArgsIface) => Promise<SandboxConformanceReportIface>;
36
+ export declare const runSandboxConformance: (kitArgs: RunSandboxConformanceArgsIface) => Promise<SandboxConformanceReportIface>;