@robota-sdk/agent-interface-session 3.0.0-beta.81

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-contracts-BVCzd3uY.d.ts","names":[],"sources":["../../src/compact-contracts.ts","../../src/session-loop-contracts.ts","../../src/prompt-file-reference-types.ts","../../src/event-contracts.ts","../../src/tool-summary-types.ts","../../src/turn-contracts.ts","../../src/driver-contracts.ts","../../src/session-event-map.ts","../../src/session-capability-contracts.ts","../../src/session-contracts.ts"],"mappings":";;;;;KASY;UAEK;EACf,SAAS;EACT,QAAQ;EACR,OAAO;;;;;KCbG;;UAGK;EACf;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA;EACA,OAAO;;EAEP;;EAEA;EACA;;EAEA;EACA;;;;;;;;;;;KChBU;UAEK;EACf;EACA;EACA;EACA,QAAQ;EACR;EACA;;;;KCEU;KACA;KACA;KACA;UAEK;WACN;WACA;WACA,QAAQ;WACR,YAAY;WACZ,MAAM;WACN,QAAQ;WACR;WACA;WACA;;KAGC;UAEK;EACf;EACA;EACA;EACA;;UAGe;EACf;EAQA;EACA;EACA;EACA;EACA,OAAO,eAAe;;KAQZ;KACA;UAEK;EACf;EACA;EACA;EACA;EACA,UAAU;EACV,QAAQ;EACR;EACA;EACA;;;;;;;;;;;UCrEe;EACf;EACA;;;;;;;;;;;;;;;;;;;UCmBe;;WAEN;;WAEA,WAAW,QAAQ;;;KAIlB;;;;;;;;;;;;;;;;;;;;;UAsBK,yBAAyB;WAC/B;WACA;WACA,QAAQ;;;;;;;;;;;;;;;;iBAiBH,kBAAkB,iBAAiB,SAAS;;UAK3C;EACf;;EAEA;EACA,SAAS;EACT,eAAe;EACf,cAAc;EACd,QAAQ;EACR,uBAAuB;;;;;;;;;;;;;;;;KAiBb;;;;;;;;;KC3FA;;cAGC,iBAAiB;;cAEjB,iBAAiB;;UAGb;;WAEN,SAAS;WACT,WAAW;;W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B,kBAAkB;EACjD,cAAc,iBAAiB;;UAGhB;EACf,WAAW;EACX,gBAAgB;EAChB,aAAa;EACb,MAAM;EACN,gBAAgB;EAChB,mBAAmB;EACnB,kBAAkB;EAClB,UAAU;EACV,mBAAmB;EACnB,UAAU;EACV,cAAc;EACd,QAAQ;EACR,kBAAkB;EAClB,iBAAiB;EACjB,kBAAkB;EAClB,oBAAoB;EACpB,WAAW;;cAGA,gCAA8B;;;;;;;;;;;;;;;;;;;KAgDtC,qBAAqB,MAAM,UAAU,KAAK,OAAO,8BACpD,aAAa,0BAEX;KAGC,sBAAsB,sBAAsB,QAAQ,0BACvD,qBAAqB,QAAQ,oBAAoB;UAElC,uBACf,sBAAsB,QAAQ,yBAAyB,QAAQ;WAEtD,cAAc,SAAS;;KAGtB,uBAAuB,sBAAsB,QAAQ,0BAC/D,uBAAuB,iBAAiB,sBAAsB;KAEpD,6BAA6B,eACvC;EAAW;KAAqB;EAAW;EAAgB,OAAO;;;;;UCzInD,4BAEb,mBACA,wBACA,qBACA,cACA,wBACA,2BACA,0BACA,kBACA,2BACA,kBACA,sBACA,gBACA,0BACA,yBACA,0BACA,4BACA;;UAGa;EACf;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,UAAU;EACV;EACA,cAAc;EACd,kBAAkB;EAClB,uBAAuB;EACvB,sBAAsB;EACtB,2BAA2B;EAC3B,eAAe;EACf,wBAAwB;EACxB,eAAe;EACf,uBAAuB;EACvB,oBAAoB;EACpB;;EAEA,OAAO;;EAEP,OAAO;;EAEP,eAAe"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../session-capability-contracts-D1Oi21Hn.cjs");function t(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Object.getPrototypeOf(n)}}function n(e){let{host:n,capability:r,capabilityKey:i,memberKey:a,forwarded:o}=e;if(a===`constructor`||a===`capabilities`||a===`__proto__`)throw TypeError(`Reserved session capability member: ${String(a)}`);if(o.has(a))throw TypeError(`Duplicate session capability member: ${String(a)}`);let s=t(r,a);if(!s)throw TypeError(`Missing ${String(i)} capability member: ${String(a)}`);let c,l=`value`in s&&typeof s.value==`function`?{value:s.value.bind(r),writable:!1}:{get:()=>{let e=Reflect.get(r,a,r);return typeof e==`function`?(c??=e.bind(r),c):e}};Object.defineProperty(n,a,{...l,configurable:!1,enumerable:!0}),o.add(a)}function r(t){let r=Object.create(null),i=new Set,a=new Set(Object.keys(e.t));for(let e of Reflect.ownKeys(t))if(!a.has(e))throw TypeError(`Unknown session capability: ${String(e)}`);let o=Object.create(null);for(let a of Reflect.ownKeys(t)){let s=Reflect.get(t,a,t);if(s!==void 0){Object.defineProperty(o,a,{configurable:!1,enumerable:!0,value:s,writable:!1});for(let t of e.t[a])n({host:r,capability:s,capabilityKey:a,memberKey:t,forwarded:i})}}return Object.freeze(o),Object.defineProperty(r,"capabilities",{configurable:!1,enumerable:!0,value:o,writable:!1}),r}function i(e,t){let n=e.capabilities[t];return n===void 0?{provided:!1}:{provided:!0,value:n}}const a={usedTokens:0,maxTokens:2e5,usedPercentage:0,remainingPercentage:100},o={sessionId:`test-session-placeholder`,updatedAt:new Date().toISOString(),entries:[]},s={id:`test-goal`,objective:`test goal`,status:`active`,iterations:0,maxIterations:25,startedAt:new Date().toISOString(),progress:[]},c={id:``,parentSessionId:`test-session-placeholder`,waitPolicy:`wait_all`,taskIds:[],status:`completed`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),results:[]};let l=0;function u(e){let t=`test-session-${l+=1}`,n=0,r=()=>{try{let e=i.getSession().getSessionId();return typeof e==`string`&&e!==``?e:t}catch{return t}},i={isInitialized:!0,getPendingCount:()=>0,getActiveDriverId:()=>null,submit:()=>Promise.resolve({turnId:`${r()}-turn-${n+=1}`,completed:Promise.resolve({response:``,history:[],toolSummaries:[],contextState:{...a}})}),abort:()=>{},cancelQueue:()=>{},shutdown:()=>Promise.resolve(),isExecuting:()=>!1,getPendingPrompt:()=>null,getMessages:()=>[],getContextState:()=>({...a}),getSession:()=>({getSessionId:()=>t}),getCwd:()=>`/workspace`,executeCommand:()=>Promise.resolve(null),listCommands:()=>[],listRuntimeTools:async()=>[],invokeRuntimeTool:async e=>({success:!1,toolName:e,error:`Unknown tool: ${e}`}),on:()=>{},off:()=>{},resolvePermission:()=>{},resolveAsk:()=>{},listBackgroundTasks:()=>[],getBackgroundTask:()=>void 0,cancelBackgroundTask:()=>Promise.resolve(),closeBackgroundTask:()=>Promise.resolve(),sendBackgroundTask:()=>Promise.resolve(),readBackgroundTaskLog:()=>Promise.resolve({taskId:``,lines:[]}),listBackgroundJobGroups:()=>[],getBackgroundJobGroup:()=>void 0,createBackgroundJobGroup:()=>({...c,parentSessionId:r()}),waitBackgroundJobGroup:()=>Promise.resolve({...c,parentSessionId:r()}),getExecutionWorkspaceSnapshot:()=>({...o,sessionId:r()}),listAgentDefinitions:()=>[],listAgentJobs:()=>[],spawnAgentJob:()=>Promise.resolve({id:`agent_1`,type:`general-purpose`,label:`general-purpose`,parentSessionId:r(),status:`running`,mode:`background`,depth:1,cwd:`/workspace`,promptPreview:``,updatedAt:new Date().toISOString()}),sendAgentJob:()=>Promise.resolve(),cancelAgentJob:()=>Promise.resolve(),closeAgentJob:()=>Promise.resolve(),setGoal:()=>Promise.resolve({...s}),getGoalState:()=>null,cancelGoal:()=>null,...e};return i}exports.createSessionCapabilityHost=r,exports.createTestSessionCapabilityHost=r,exports.createTestInteractiveSession=u,exports.readSessionCapability=i;
@@ -0,0 +1,12 @@
1
+ import { C as TSessionCapabilityHost, s as ISessionCapabilityMap, t as IInteractiveSession, w as TSessionCapabilityReadResult } from "../session-contracts-BVCzd3uY.cjs";
2
+ //#region src/testing/session-capability-host.d.ts
3
+ declare function createSessionCapabilityHost<const TCapabilities extends Partial<ISessionCapabilityMap>>(capabilities: TCapabilities): TSessionCapabilityHost<TCapabilities>;
4
+ declare function readSessionCapability<TCapabilities extends Partial<ISessionCapabilityMap>, TKey extends keyof ISessionCapabilityMap>(host: Readonly<{
5
+ capabilities: TCapabilities;
6
+ }>, key: TKey): TSessionCapabilityReadResult<ISessionCapabilityMap[TKey]>;
7
+ //#endregion
8
+ //#region src/testing/interactive-session-double.d.ts
9
+ declare function createTestInteractiveSession(overrides?: Partial<IInteractiveSession>): IInteractiveSession;
10
+ //#endregion
11
+ export { createSessionCapabilityHost, createSessionCapabilityHost as createTestSessionCapabilityHost, createTestInteractiveSession, readSessionCapability };
12
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/testing/session-capability-host.ts","../../../src/testing/interactive-session-double.ts"],"mappings":";;iBAsEgB,kCACR,sBAAsB,QAAQ,wBACpC,cAAc,gBAAgB,uBAAuB;iBAiCvC,sBACd,sBAAsB,QAAQ,wBAC9B,mBAAmB,uBAEnB,MAAM;EAAW,cAAc;IAC/B,KAAK,OACJ,6BAA6B,sBAAsB;;;iBC7CtC,6BACd,YAAY,QAAQ,uBACnB"}
@@ -0,0 +1,12 @@
1
+ import { C as TSessionCapabilityHost, s as ISessionCapabilityMap, t as IInteractiveSession, w as TSessionCapabilityReadResult } from "../session-contracts-BVCzd3uY.js";
2
+ //#region src/testing/session-capability-host.d.ts
3
+ declare function createSessionCapabilityHost<const TCapabilities extends Partial<ISessionCapabilityMap>>(capabilities: TCapabilities): TSessionCapabilityHost<TCapabilities>;
4
+ declare function readSessionCapability<TCapabilities extends Partial<ISessionCapabilityMap>, TKey extends keyof ISessionCapabilityMap>(host: Readonly<{
5
+ capabilities: TCapabilities;
6
+ }>, key: TKey): TSessionCapabilityReadResult<ISessionCapabilityMap[TKey]>;
7
+ //#endregion
8
+ //#region src/testing/interactive-session-double.d.ts
9
+ declare function createTestInteractiveSession(overrides?: Partial<IInteractiveSession>): IInteractiveSession;
10
+ //#endregion
11
+ export { createSessionCapabilityHost, createSessionCapabilityHost as createTestSessionCapabilityHost, createTestInteractiveSession, readSessionCapability };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/testing/session-capability-host.ts","../../../src/testing/interactive-session-double.ts"],"mappings":";;iBAsEgB,kCACR,sBAAsB,QAAQ,wBACpC,cAAc,gBAAgB,uBAAuB;iBAiCvC,sBACd,sBAAsB,QAAQ,wBAC9B,mBAAmB,uBAEnB,MAAM;EAAW,cAAc;IAC/B,KAAK,OACJ,6BAA6B,sBAAsB;;;iBC7CtC,6BACd,YAAY,QAAQ,uBACnB"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../session-capability-contracts-LonmBQKB.js";function t(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Object.getPrototypeOf(n)}}function n(e){let{host:n,capability:r,capabilityKey:i,memberKey:a,forwarded:o}=e;if(a===`constructor`||a===`capabilities`||a===`__proto__`)throw TypeError(`Reserved session capability member: ${String(a)}`);if(o.has(a))throw TypeError(`Duplicate session capability member: ${String(a)}`);let s=t(r,a);if(!s)throw TypeError(`Missing ${String(i)} capability member: ${String(a)}`);let c,l=`value`in s&&typeof s.value==`function`?{value:s.value.bind(r),writable:!1}:{get:()=>{let e=Reflect.get(r,a,r);return typeof e==`function`?(c??=e.bind(r),c):e}};Object.defineProperty(n,a,{...l,configurable:!1,enumerable:!0}),o.add(a)}function r(t){let r=Object.create(null),i=new Set,a=new Set(Object.keys(e));for(let e of Reflect.ownKeys(t))if(!a.has(e))throw TypeError(`Unknown session capability: ${String(e)}`);let o=Object.create(null);for(let a of Reflect.ownKeys(t)){let s=Reflect.get(t,a,t);if(s!==void 0){Object.defineProperty(o,a,{configurable:!1,enumerable:!0,value:s,writable:!1});for(let t of e[a])n({host:r,capability:s,capabilityKey:a,memberKey:t,forwarded:i})}}return Object.freeze(o),Object.defineProperty(r,"capabilities",{configurable:!1,enumerable:!0,value:o,writable:!1}),r}function i(e,t){let n=e.capabilities[t];return n===void 0?{provided:!1}:{provided:!0,value:n}}const a={usedTokens:0,maxTokens:2e5,usedPercentage:0,remainingPercentage:100},o={sessionId:`test-session-placeholder`,updatedAt:new Date().toISOString(),entries:[]},s={id:`test-goal`,objective:`test goal`,status:`active`,iterations:0,maxIterations:25,startedAt:new Date().toISOString(),progress:[]},c={id:``,parentSessionId:`test-session-placeholder`,waitPolicy:`wait_all`,taskIds:[],status:`completed`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),results:[]};let l=0;function u(e){let t=`test-session-${l+=1}`,n=0,r=()=>{try{let e=i.getSession().getSessionId();return typeof e==`string`&&e!==``?e:t}catch{return t}},i={isInitialized:!0,getPendingCount:()=>0,getActiveDriverId:()=>null,submit:()=>Promise.resolve({turnId:`${r()}-turn-${n+=1}`,completed:Promise.resolve({response:``,history:[],toolSummaries:[],contextState:{...a}})}),abort:()=>{},cancelQueue:()=>{},shutdown:()=>Promise.resolve(),isExecuting:()=>!1,getPendingPrompt:()=>null,getMessages:()=>[],getContextState:()=>({...a}),getSession:()=>({getSessionId:()=>t}),getCwd:()=>`/workspace`,executeCommand:()=>Promise.resolve(null),listCommands:()=>[],listRuntimeTools:async()=>[],invokeRuntimeTool:async e=>({success:!1,toolName:e,error:`Unknown tool: ${e}`}),on:()=>{},off:()=>{},resolvePermission:()=>{},resolveAsk:()=>{},listBackgroundTasks:()=>[],getBackgroundTask:()=>void 0,cancelBackgroundTask:()=>Promise.resolve(),closeBackgroundTask:()=>Promise.resolve(),sendBackgroundTask:()=>Promise.resolve(),readBackgroundTaskLog:()=>Promise.resolve({taskId:``,lines:[]}),listBackgroundJobGroups:()=>[],getBackgroundJobGroup:()=>void 0,createBackgroundJobGroup:()=>({...c,parentSessionId:r()}),waitBackgroundJobGroup:()=>Promise.resolve({...c,parentSessionId:r()}),getExecutionWorkspaceSnapshot:()=>({...o,sessionId:r()}),listAgentDefinitions:()=>[],listAgentJobs:()=>[],spawnAgentJob:()=>Promise.resolve({id:`agent_1`,type:`general-purpose`,label:`general-purpose`,parentSessionId:r(),status:`running`,mode:`background`,depth:1,cwd:`/workspace`,promptPreview:``,updatedAt:new Date().toISOString()}),sendAgentJob:()=>Promise.resolve(),cancelAgentJob:()=>Promise.resolve(),closeAgentJob:()=>Promise.resolve(),setGoal:()=>Promise.resolve({...s}),getGoalState:()=>null,cancelGoal:()=>null,...e};return i}export{r as createSessionCapabilityHost,r as createTestSessionCapabilityHost,u as createTestInteractiveSession,i as readSessionCapability};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/testing/session-capability-host.ts","../../../src/testing/interactive-session-double.ts"],"sourcesContent":["/**\n * HARNESS-103: the session-capability host MECHANISM, moved out of the interface package's\n * contract surface.\n *\n * This testing-only factory walks prototypes, caches accessors, rejects reserved or duplicate\n * members, and freezes the resulting host. It is a test double rather than a contract declaration.\n *\n * It lives under `testing/` because its consumers are this package's unit test and the testing\n * subpath's `createTestSessionCapabilityHost`; it is not part of the production contract surface.\n *\n * The CONTRACTS it satisfies (`ISessionCapabilityHost`, `TSessionCapabilityHost`,\n * `TSessionCapabilityReadResult`) stayed in `session-capability-contracts.ts`, where contracts go.\n */\n\nimport { SESSION_CAPABILITY_MEMBER_KEYS } from '../session-capability-contracts.js';\n\nimport type {\n ISessionCapabilityMap,\n TSessionCapabilityHost,\n TSessionCapabilityReadResult,\n} from '../session-capability-contracts.js';\n\nfunction findPropertyDescriptor(target: object, key: PropertyKey): PropertyDescriptor | undefined {\n let current: object | null = target;\n while (current !== null && current !== Object.prototype) {\n const descriptor = Object.getOwnPropertyDescriptor(current, key);\n if (descriptor) return descriptor;\n current = Object.getPrototypeOf(current);\n }\n return undefined;\n}\n\nfunction forwardCapabilityMember(input: {\n host: object;\n capability: object;\n capabilityKey: keyof ISessionCapabilityMap;\n memberKey: PropertyKey;\n forwarded: Set<PropertyKey>;\n}): void {\n const { host, capability, capabilityKey, memberKey, forwarded } = input;\n if (memberKey === 'constructor' || memberKey === 'capabilities' || memberKey === '__proto__') {\n throw new TypeError(`Reserved session capability member: ${String(memberKey)}`);\n }\n if (forwarded.has(memberKey)) {\n throw new TypeError(`Duplicate session capability member: ${String(memberKey)}`);\n }\n const descriptor = findPropertyDescriptor(capability, memberKey);\n if (!descriptor) {\n throw new TypeError(`Missing ${String(capabilityKey)} capability member: ${String(memberKey)}`);\n }\n let cachedFunction: ((...args: never[]) => unknown) | undefined;\n const forwardedDescriptor: PropertyDescriptor =\n 'value' in descriptor && typeof descriptor.value === 'function'\n ? { value: descriptor.value.bind(capability), writable: false }\n : {\n get: () => {\n const value = Reflect.get(capability, memberKey, capability);\n if (typeof value !== 'function') return value;\n cachedFunction ??= value.bind(capability);\n return cachedFunction;\n },\n };\n Object.defineProperty(host, memberKey, {\n ...forwardedDescriptor,\n configurable: false,\n enumerable: true,\n });\n forwarded.add(memberKey);\n}\n\nexport function createSessionCapabilityHost<\n const TCapabilities extends Partial<ISessionCapabilityMap>,\n>(capabilities: TCapabilities): TSessionCapabilityHost<TCapabilities> {\n const host: object = Object.create(null);\n const forwarded = new Set<PropertyKey>();\n const knownCapabilityKeys = new Set<PropertyKey>(Object.keys(SESSION_CAPABILITY_MEMBER_KEYS));\n for (const key of Reflect.ownKeys(capabilities)) {\n if (!knownCapabilityKeys.has(key)) {\n throw new TypeError(`Unknown session capability: ${String(key)}`);\n }\n }\n const canonicalCapabilities: Partial<ISessionCapabilityMap> = Object.create(null);\n for (const capabilityKey of Reflect.ownKeys(capabilities) as (keyof ISessionCapabilityMap)[]) {\n const capability = Reflect.get(capabilities, capabilityKey, capabilities);\n if (capability === undefined) continue;\n Object.defineProperty(canonicalCapabilities, capabilityKey, {\n configurable: false,\n enumerable: true,\n value: capability,\n writable: false,\n });\n for (const memberKey of SESSION_CAPABILITY_MEMBER_KEYS[capabilityKey]) {\n forwardCapabilityMember({ host, capability, capabilityKey, memberKey, forwarded });\n }\n }\n Object.freeze(canonicalCapabilities);\n Object.defineProperty(host, 'capabilities', {\n configurable: false,\n enumerable: true,\n value: canonicalCapabilities as Readonly<TCapabilities>,\n writable: false,\n });\n return host as TSessionCapabilityHost<TCapabilities>;\n}\n\nexport function readSessionCapability<\n TCapabilities extends Partial<ISessionCapabilityMap>,\n TKey extends keyof ISessionCapabilityMap,\n>(\n host: Readonly<{ capabilities: TCapabilities }>,\n key: TKey,\n): TSessionCapabilityReadResult<ISessionCapabilityMap[TKey]> {\n const value = host.capabilities[key];\n return value === undefined\n ? { provided: false }\n : { provided: true, value: value as ISessionCapabilityMap[TKey] };\n}\n","// Imported from the DECLARING module, not the package barrel. Issue #2109 was one line of exactly\n// this shape — a module reaching a type through a re-exporter — and it accounted for 2 of the 12\n// cycles the transport omnibus carried. The sibling double next to this one does the same.\nimport type { IInteractiveSession } from '../session-contracts.js';\n\nconst EMPTY_CONTEXT_STATE = {\n usedTokens: 0,\n maxTokens: 200000,\n usedPercentage: 0,\n remainingPercentage: 100,\n};\n\n// `sessionId` here is a PLACEHOLDER. Every read of these shapes goes through the factory below,\n// which stamps the double's own id over it — see the note on `sessionId` there. Left as a literal\n// so the shape stays a plain constant; nothing outside the factory should read it.\nconst EMPTY_EXECUTION_WORKSPACE = {\n sessionId: 'test-session-placeholder',\n updatedAt: new Date().toISOString(),\n entries: [] as [],\n};\n\nconst EMPTY_GOAL_STATE = {\n id: 'test-goal',\n objective: 'test goal',\n status: 'active' as const,\n iterations: 0,\n maxIterations: 25,\n startedAt: new Date().toISOString(),\n progress: [] as [],\n};\n\nconst EMPTY_BACKGROUND_GROUP = {\n id: '',\n parentSessionId: 'test-session-placeholder',\n waitPolicy: 'wait_all' as const,\n taskIds: [],\n status: 'completed' as const,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n results: [],\n};\n\n/**\n * The conformant `IInteractiveSession` double, next to the contract it implements. ARCH-012.\n *\n * WHY IT LIVES HERE. A double for this contract already existed, published, and documented — in\n * `@robota-sdk/agent-framework`. It had **zero consumers**, and the reason is the dependency\n * direction: every transport package sits BELOW `agent-framework`, so none of them can import it.\n * The 41 hand-rolled `as unknown as IInteractiveSession` partials across 29 files were not an\n * oversight; they were the only thing those packages could reach.\n *\n * Placed with the contract, it is importable by everything that consumes the contract — but behind\n * the `./testing` SUBPATH, never the main entry. `code-quality.md` is explicit about that, and the\n * reason is concrete: the main entry is the shipped runtime bundle of a published package, and a test\n * fixture has no business in it. `@robota-sdk/agent-core/testing`'s scripted-provider is the\n * precedent. The first draft of this move put it on the main entry and review measured the double in\n * `dist/node/index.js`.\n *\n * WHAT MAKES IT CONFORMANT: it is typed as `IInteractiveSession` with no cast, so the compiler\n * refuses it the moment the contract gains a member. That is the property the private partials do not\n * have — each was checked against nothing, so the suites built on them proved things no shipped code\n * guarantees.\n */\n/** Counts doubles so each gets its own session id. See `getSessionId` below. */\nlet doublesCreated = 0;\n\nexport function createTestInteractiveSession(\n overrides?: Partial<IInteractiveSession>,\n): IInteractiveSession {\n const fallbackId = `test-session-${(doublesCreated += 1)}`;\n let submissionsAccepted = 0;\n /**\n * The id EVERY surface of this double names — including when a caller overrides `getSession`.\n *\n * `parentSessionId`/workspace `sessionId` used to close over the counter value directly, so an\n * overridden `getSession().getSessionId()` and the other surfaces disagreed about who this\n * session is — the exact cross-surface id collision the counter was added to remove, reopened by\n * the override path. Review found it before a suite did. Resolved LAZILY through the assembled\n * object, falling back to the counter when the override cannot answer (throws, or returns an\n * empty id — both are shapes tests deliberately build).\n */\n const sessionId = (): string => {\n try {\n const id = assembled.getSession().getSessionId();\n return typeof id === 'string' && id !== '' ? id : fallbackId;\n } catch {\n // allow-fallback: a double whose getSession deliberately throws still needs a name for its OTHER surfaces\n return fallbackId;\n }\n };\n const base: IInteractiveSession = {\n // ARCH-012: required, not optional. A double that omitted them let a consumer's\n // `getActiveDriverId?.()` resolve to `undefined` and read as \"no active driver\" — the ambiguity\n // the contract change removes. `null` here means nobody is driving, and only that.\n isInitialized: true,\n getPendingCount: () => 0,\n getActiveDriverId: () => null,\n // RUNTIME-003: a double must hand back a handle that SETTLES, because that is the promise the\n // contract makes and a double that never settled would let a suite pass while the consumer it\n // stands in for hangs. The default turn ends at once with an empty result.\n submit: () =>\n Promise.resolve({\n turnId: `${sessionId()}-turn-${(submissionsAccepted += 1)}`,\n completed: Promise.resolve({\n response: '',\n history: [],\n toolSummaries: [],\n contextState: { ...EMPTY_CONTEXT_STATE },\n }),\n }),\n abort: () => {},\n cancelQueue: () => {},\n shutdown: () => Promise.resolve(),\n isExecuting: () => false,\n getPendingPrompt: () => null,\n getMessages: () => [],\n getContextState: () => ({ ...EMPTY_CONTEXT_STATE }),\n getSession: () => ({\n // DISTINCT per double, because a session id IDENTIFIES a session. A fixed literal made every\n // instance report the same identity, so two doubles standing in for two different sessions\n // were indistinguishable to any consumer that keys by id — and a fixture that cannot\n // represent two sessions cannot test anything about two sessions. Found when\n // `agent-transport-http` started keying its concurrent-turn claim by id and the multi-tenant\n // case went red for the fixture's reason rather than the code's.\n //\n // A counter, not a random: the value stays stable within one double and reproducible across\n // runs, so a failure message names the same session twice.\n getSessionId: () => fallbackId,\n }),\n getCwd: () => '/workspace',\n executeCommand: () => Promise.resolve(null),\n listCommands: () => [],\n listRuntimeTools: async () => [],\n invokeRuntimeTool: async (name) => ({\n success: false,\n toolName: name,\n error: `Unknown tool: ${name}`,\n }),\n on: () => {},\n off: () => {},\n resolvePermission: () => {},\n resolveAsk: () => {},\n listBackgroundTasks: () => [],\n getBackgroundTask: () => undefined,\n cancelBackgroundTask: () => Promise.resolve(),\n closeBackgroundTask: () => Promise.resolve(),\n sendBackgroundTask: () => Promise.resolve(),\n readBackgroundTaskLog: () => Promise.resolve({ taskId: '', lines: [] }),\n listBackgroundJobGroups: () => [],\n getBackgroundJobGroup: () => undefined,\n // EVERY surface that names this session names the SAME id, and review is why. Making\n // `getSessionId()` per-double left three others on a shared literal — so a consumer that\n // distinguishes two doubles by `parentSessionId` or by the workspace snapshot's `sessionId`\n // still saw one session where there were two, which is the exact collision the change was\n // meant to remove, one field over.\n createBackgroundJobGroup: () => ({ ...EMPTY_BACKGROUND_GROUP, parentSessionId: sessionId() }),\n waitBackgroundJobGroup: () =>\n Promise.resolve({ ...EMPTY_BACKGROUND_GROUP, parentSessionId: sessionId() }),\n getExecutionWorkspaceSnapshot: () => ({ ...EMPTY_EXECUTION_WORKSPACE, sessionId: sessionId() }),\n listAgentDefinitions: () => [],\n listAgentJobs: () => [],\n spawnAgentJob: () =>\n Promise.resolve({\n id: 'agent_1',\n type: 'general-purpose',\n label: 'general-purpose',\n parentSessionId: sessionId(),\n status: 'running' as const,\n mode: 'background' as const,\n depth: 1,\n cwd: '/workspace',\n promptPreview: '',\n updatedAt: new Date().toISOString(),\n }),\n sendAgentJob: () => Promise.resolve(),\n cancelAgentJob: () => Promise.resolve(),\n closeAgentJob: () => Promise.resolve(),\n setGoal: () => Promise.resolve({ ...EMPTY_GOAL_STATE }),\n getGoalState: () => null,\n cancelGoal: () => null,\n ...overrides,\n };\n const assembled = base;\n return assembled;\n}\n"],"mappings":"gEAsBA,SAAS,EAAuB,EAAgB,EAAkD,CAChG,IAAI,EAAyB,EAC7B,KAAO,IAAY,MAAQ,IAAY,OAAO,WAAW,CACvD,IAAM,EAAa,OAAO,yBAAyB,EAAS,CAAG,EAC/D,GAAI,EAAY,OAAO,EACvB,EAAU,OAAO,eAAe,CAAO,CACzC,CAEF,CAEA,SAAS,EAAwB,EAMxB,CACP,GAAM,CAAE,OAAM,aAAY,gBAAe,YAAW,aAAc,EAClE,GAAI,IAAc,eAAiB,IAAc,gBAAkB,IAAc,YAC/E,MAAU,UAAU,uCAAuC,OAAO,CAAS,GAAG,EAEhF,GAAI,EAAU,IAAI,CAAS,EACzB,MAAU,UAAU,wCAAwC,OAAO,CAAS,GAAG,EAEjF,IAAM,EAAa,EAAuB,EAAY,CAAS,EAC/D,GAAI,CAAC,EACH,MAAU,UAAU,WAAW,OAAO,CAAa,EAAE,sBAAsB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Ac,aACd,mBAAsB,QAAQ,QAAQ,IAAI,EAC1C,iBAAoB,CAAC,EACrB,iBAAkB,SAAY,CAAC,EAC/B,kBAAmB,KAAO,KAAU,CAClC,QAAS,GACT,SAAU,EACV,MAAO,iBAAiB,GAC1B,GACA,OAAU,CAAC,EACX,QAAW,CAAC,EACZ,sBAAyB,CAAC,EAC1B,eAAkB,CAAC,EACnB,wBAA2B,CAAC,EAC5B,sBAAyB,IAAA,GACzB,yBAA4B,QAAQ,QAAQ,EAC5C,wBAA2B,QAAQ,QAAQ,EAC3C,uBAA0B,QAAQ,QAAQ,EAC1C,0BAA6B,QAAQ,QAAQ,CAAE,OAAQ,GAAI,MAAO,CAAC,CAAE,CAAC,EACtE,4BAA+B,CAAC,EAChC,0BAA6B,IAAA,GAM7B,8BAAiC,CAAE,GAAG,EAAwB,gBAAiB,EAAU,CAAE,GAC3F,2BACE,QAAQ,QAAQ,CAAE,GAAG,EAAwB,gBAAiB,EAAU,CAAE,CAAC,EAC7E,mCAAsC,CAAE,GAAG,EAA2B,UAAW,EAAU,CAAE,GAC7F,yBAA4B,CAAC,EAC7B,kBAAqB,CAAC,EACtB,kBACE,QAAQ,QAAQ,CACd,GAAI,UACJ,KAAM,kBACN,MAAO,kBACP,gBAAiB,EAAU,EAC3B,OAAQ,UACR,KAAM,aACN,MAAO,EACP,IAAK,aACL,cAAe,GACf,UAAW,IAAI,KAAK,CAAA,CAAE,YAAY,CACpC,CAAC,EACH,iBAAoB,QAAQ,QAAQ,EACpC,mBAAsB,QAAQ,QAAQ,EACtC,kBAAqB,QAAQ,QAAQ,EACrC,YAAe,QAAQ,QAAQ,CAAE,GAAG,CAAiB,CAAC,EACtD,iBAAoB,KACpB,eAAkB,KAClB,GAAG,CAEgB,EACrB,OAAO,CACT"}
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@robota-sdk/agent-interface-session",
3
+ "version": "3.0.0-beta.81",
4
+ "description": "Session contract interfaces for the Robota SDK — interactive sessions, interaction channels, session events, turns and persistence",
5
+ "type": "module",
6
+ "main": "dist/node/index.js",
7
+ "types": "dist/node/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "node": {
12
+ "import": {
13
+ "types": "./dist/node/index.d.ts",
14
+ "default": "./dist/node/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/node/index.d.cts",
18
+ "default": "./dist/node/index.cjs"
19
+ }
20
+ },
21
+ "default": {
22
+ "import": {
23
+ "types": "./dist/node/index.d.ts",
24
+ "default": "./dist/node/index.js"
25
+ },
26
+ "require": {
27
+ "types": "./dist/node/index.d.cts",
28
+ "default": "./dist/node/index.cjs"
29
+ }
30
+ }
31
+ },
32
+ "./testing": {
33
+ "source": "./src/testing/index.ts",
34
+ "node": {
35
+ "import": {
36
+ "types": "./dist/node/testing/index.d.ts",
37
+ "default": "./dist/node/testing/index.js"
38
+ },
39
+ "require": {
40
+ "types": "./dist/node/testing/index.d.cts",
41
+ "default": "./dist/node/testing/index.cjs"
42
+ }
43
+ },
44
+ "default": {
45
+ "import": {
46
+ "types": "./dist/node/testing/index.d.ts",
47
+ "default": "./dist/node/testing/index.js"
48
+ },
49
+ "require": {
50
+ "types": "./dist/node/testing/index.d.cts",
51
+ "default": "./dist/node/testing/index.cjs"
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/woojubb/robota.git"
59
+ },
60
+ "homepage": "https://robota.io/",
61
+ "bugs": {
62
+ "url": "https://github.com/woojubb/robota/issues"
63
+ },
64
+ "files": [
65
+ "dist"
66
+ ],
67
+ "dependencies": {
68
+ "@robota-sdk/agent-core": "3.0.0-beta.81",
69
+ "@robota-sdk/agent-interface-analytics": "3.0.0-beta.81",
70
+ "@robota-sdk/agent-interface-command": "3.0.0-beta.81",
71
+ "@robota-sdk/agent-interface-execution": "3.0.0-beta.81"
72
+ },
73
+ "devDependencies": {
74
+ "rimraf": "^5.0.10",
75
+ "tsdown": "^0.22.14",
76
+ "vitest": "^3.2.6"
77
+ },
78
+ "license": "AGPL-3.0-only OR LicenseRef-Commercial",
79
+ "publishConfig": {
80
+ "access": "public"
81
+ },
82
+ "private": false,
83
+ "volta": {
84
+ "extends": "../../package.json"
85
+ },
86
+ "scripts": {
87
+ "build": "rimraf dist && tsdown",
88
+ "build:js": "pnpm run build",
89
+ "build:types": "pnpm run build",
90
+ "test": "vitest run --passWithNoTests",
91
+ "test:coverage": "vitest run --coverage --passWithNoTests",
92
+ "typecheck": "tsgo --noEmit",
93
+ "lint": "eslint src/ --ext .ts",
94
+ "clean": "rimraf dist"
95
+ }
96
+ }