@memberjunction/ai-agent-harness 0.0.0 → 6.1.0-edge.2
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/LICENSE +7 -0
- package/README.md +192 -27
- package/dist/HarnessAgentBase.d.ts +261 -0
- package/dist/HarnessAgentBase.d.ts.map +1 -0
- package/dist/HarnessAgentBase.js +822 -0
- package/dist/HarnessAgentBase.js.map +1 -0
- package/dist/HarnessAgentType.d.ts +39 -0
- package/dist/HarnessAgentType.d.ts.map +1 -0
- package/dist/HarnessAgentType.js +50 -0
- package/dist/HarnessAgentType.js.map +1 -0
- package/dist/adapters/BaseCliHarnessAdapter.d.ts +93 -0
- package/dist/adapters/BaseCliHarnessAdapter.d.ts.map +1 -0
- package/dist/adapters/BaseCliHarnessAdapter.js +184 -0
- package/dist/adapters/BaseCliHarnessAdapter.js.map +1 -0
- package/dist/adapters/BaseHarnessAdapter.d.ts +114 -0
- package/dist/adapters/BaseHarnessAdapter.d.ts.map +1 -0
- package/dist/adapters/BaseHarnessAdapter.js +86 -0
- package/dist/adapters/BaseHarnessAdapter.js.map +1 -0
- package/dist/adapters/ClaudeCodeCliAdapter.d.ts +104 -0
- package/dist/adapters/ClaudeCodeCliAdapter.d.ts.map +1 -0
- package/dist/adapters/ClaudeCodeCliAdapter.js +268 -0
- package/dist/adapters/ClaudeCodeCliAdapter.js.map +1 -0
- package/dist/adapters/CodexAdapter.d.ts +27 -0
- package/dist/adapters/CodexAdapter.d.ts.map +1 -0
- package/dist/adapters/CodexAdapter.js +117 -0
- package/dist/adapters/CodexAdapter.js.map +1 -0
- package/dist/adapters/GeminiCliAdapter.d.ts +25 -0
- package/dist/adapters/GeminiCliAdapter.d.ts.map +1 -0
- package/dist/adapters/GeminiCliAdapter.js +98 -0
- package/dist/adapters/GeminiCliAdapter.js.map +1 -0
- package/dist/adapters/OpenCodeAdapter.d.ts +23 -0
- package/dist/adapters/OpenCodeAdapter.d.ts.map +1 -0
- package/dist/adapters/OpenCodeAdapter.js +104 -0
- package/dist/adapters/OpenCodeAdapter.js.map +1 -0
- package/dist/adapters/PiAdapter.d.ts +73 -0
- package/dist/adapters/PiAdapter.d.ts.map +1 -0
- package/dist/adapters/PiAdapter.js +237 -0
- package/dist/adapters/PiAdapter.js.map +1 -0
- package/dist/adapters/StdioJsonAdapter.d.ts +43 -0
- package/dist/adapters/StdioJsonAdapter.d.ts.map +1 -0
- package/dist/adapters/StdioJsonAdapter.js +109 -0
- package/dist/adapters/StdioJsonAdapter.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/ChildProcessExecutor.d.ts +41 -0
- package/dist/sandbox/ChildProcessExecutor.d.ts.map +1 -0
- package/dist/sandbox/ChildProcessExecutor.js +86 -0
- package/dist/sandbox/ChildProcessExecutor.js.map +1 -0
- package/dist/sandbox/DockerSandboxProvider.d.ts +64 -0
- package/dist/sandbox/DockerSandboxProvider.d.ts.map +1 -0
- package/dist/sandbox/DockerSandboxProvider.js +176 -0
- package/dist/sandbox/DockerSandboxProvider.js.map +1 -0
- package/dist/sandbox/ISandboxProvider.d.ts +71 -0
- package/dist/sandbox/ISandboxProvider.d.ts.map +1 -0
- package/dist/sandbox/ISandboxProvider.js +2 -0
- package/dist/sandbox/ISandboxProvider.js.map +1 -0
- package/dist/sandbox/LocalDirectorySandboxProvider.d.ts +37 -0
- package/dist/sandbox/LocalDirectorySandboxProvider.d.ts.map +1 -0
- package/dist/sandbox/LocalDirectorySandboxProvider.js +75 -0
- package/dist/sandbox/LocalDirectorySandboxProvider.js.map +1 -0
- package/dist/sandbox/SandboxExecutor.d.ts +47 -0
- package/dist/sandbox/SandboxExecutor.d.ts.map +1 -0
- package/dist/sandbox/SandboxExecutor.js +2 -0
- package/dist/sandbox/SandboxExecutor.js.map +1 -0
- package/dist/types.d.ts +180 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +35 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HarnessAgentBase.js","sourceRoot":"","sources":["../src/HarnessAgentBase.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAO5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAS3E;;;;;;GAMG;AACH,MAAM,2BAA2B,GAA2B;IACxD,oBAAoB,EAAE,mBAAmB;IACzC,YAAY,EAAE,gBAAgB;IAC9B,gBAAgB,EAAE,gBAAgB;CACrC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG;IACtB,KAAK;IACL,qFAAqF;IACrF,yFAAyF;IACzF,6FAA6F;IAC7F,uEAAuE;CAC1E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAgBb;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,SAAS;IAAxC;;QACK,YAAO,GAA8B,IAAI,CAAC;QAC1C,oBAAe,GAA4B,IAAI,CAAC;QAChD,kBAAa,GAAyB,IAAI,CAAC;QAC3C,eAAU,GAAkC,IAAI,CAAC;QACjD,cAAS,GAAG,CAAC,CAAC;IA40B1B,CAAC;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AmD,CAAC,SAAS,EAAE,EAAE,IAAI,aAAa,CAAC;IAC/F,CAAC;IAEO,gBAAgB;QACpB,OAAO,IAAI,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC;IACvD,CAAC;IAED;;;;;;;OAOG;IACK,uBAAuB;QAC3B,OAAQ,IAAsE,CAAC,SAAS,EAAE,cAAc,IAAI,IAAI,CAAC;IACrH,CAAC;IAEO,uBAAuB;QAC3B,OAAO,IAAI,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,iBAAiB,IAAI,IAAI,CAAC;IACxE,CAAC;IAEO,mBAAmB;QACvB,OAAQ,IAEN,CAAC,cAAc,CAAC;IACtB,CAAC;CACJ,CAAA;AAj1BY,gBAAgB;IAD5B,aAAa,CAAC,SAAS,EAAE,kBAAkB,CAAC;GAChC,gBAAgB,CAi1B5B;;AAED,SAAS,aAAa,CAAC,CAAU;IAC7B,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LoopAgentType } from '@memberjunction/ai-agents';
|
|
2
|
+
/**
|
|
3
|
+
* The `Harness` agent type — an MJ agent whose reasoning is supplied by an external agent harness.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this subclasses LoopAgentType rather than BaseAgentType
|
|
6
|
+
*
|
|
7
|
+
* A harness turn is protocol-identical to a Loop agent's prompt iteration. The harness reasons, then
|
|
8
|
+
* ends its turn by emitting the same next-step JSON envelope a Loop model emits. Everything
|
|
9
|
+
* downstream of that decision — `validateActionsNextStep`, `validateSubAgentNextStep`, per-action
|
|
10
|
+
* `MaxExecutionsPerRun`, skill activation gates, plan-mode blocking, `PayloadManager` path ACLs,
|
|
11
|
+
* `checkExecutionGuardrails` between iterations, run-step recording — is already written and already
|
|
12
|
+
* correct.
|
|
13
|
+
*
|
|
14
|
+
* Inheriting `DetermineNextStep` wholesale is therefore not a shortcut, it is the entire point: it
|
|
15
|
+
* means a harness agent runs inside MJ's enforcement stack rather than beside it, with no second
|
|
16
|
+
* authority path to audit. An independent implementation would have to re-derive every one of those
|
|
17
|
+
* guarantees and would drift from the Loop path the first time either changed.
|
|
18
|
+
*
|
|
19
|
+
* ## The dual-registry key
|
|
20
|
+
*
|
|
21
|
+
* ClassFactory registrations are namespaced per base class, so the string `'HarnessAgentType'` is
|
|
22
|
+
* registered TWICE against different roots:
|
|
23
|
+
*
|
|
24
|
+
* · here, under `BaseAgentType` — resolved by `BaseAgentType.GetAgentTypeInstance` from
|
|
25
|
+
* `AIAgentType.DriverClass`, giving the turn-protocol behaviour;
|
|
26
|
+
* · in {@link HarnessAgentBase}, under `BaseAgent` — resolved by `AgentRunner` from the same
|
|
27
|
+
* column, giving the execution driver that substitutes a harness turn for a prompt call.
|
|
28
|
+
*
|
|
29
|
+
* That is the mechanism working as designed rather than an overload: `AgentRunner` already treats
|
|
30
|
+
* the agent type's `DriverClass` as a `BaseAgent` key and falls back to plain `BaseAgent` when the
|
|
31
|
+
* key is unregistered there, which is exactly why every Loop agent gets the base execution class
|
|
32
|
+
* today. Registering both makes one metadata column select both halves.
|
|
33
|
+
*
|
|
34
|
+
* The subtlety is worth stating because it is invisible at each registration site on its own: seeing
|
|
35
|
+
* only this file, a reader would reasonably assume `'HarnessAgentType'` names one class.
|
|
36
|
+
*/
|
|
37
|
+
export declare class HarnessAgentType extends LoopAgentType {
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=HarnessAgentType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HarnessAgentType.d.ts","sourceRoot":"","sources":["../src/HarnessAgentType.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBACa,gBAAiB,SAAQ,aAAa;CASlD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
8
|
+
import { BaseAgentType, LoopAgentType } from '@memberjunction/ai-agents';
|
|
9
|
+
/**
|
|
10
|
+
* The `Harness` agent type — an MJ agent whose reasoning is supplied by an external agent harness.
|
|
11
|
+
*
|
|
12
|
+
* ## Why this subclasses LoopAgentType rather than BaseAgentType
|
|
13
|
+
*
|
|
14
|
+
* A harness turn is protocol-identical to a Loop agent's prompt iteration. The harness reasons, then
|
|
15
|
+
* ends its turn by emitting the same next-step JSON envelope a Loop model emits. Everything
|
|
16
|
+
* downstream of that decision — `validateActionsNextStep`, `validateSubAgentNextStep`, per-action
|
|
17
|
+
* `MaxExecutionsPerRun`, skill activation gates, plan-mode blocking, `PayloadManager` path ACLs,
|
|
18
|
+
* `checkExecutionGuardrails` between iterations, run-step recording — is already written and already
|
|
19
|
+
* correct.
|
|
20
|
+
*
|
|
21
|
+
* Inheriting `DetermineNextStep` wholesale is therefore not a shortcut, it is the entire point: it
|
|
22
|
+
* means a harness agent runs inside MJ's enforcement stack rather than beside it, with no second
|
|
23
|
+
* authority path to audit. An independent implementation would have to re-derive every one of those
|
|
24
|
+
* guarantees and would drift from the Loop path the first time either changed.
|
|
25
|
+
*
|
|
26
|
+
* ## The dual-registry key
|
|
27
|
+
*
|
|
28
|
+
* ClassFactory registrations are namespaced per base class, so the string `'HarnessAgentType'` is
|
|
29
|
+
* registered TWICE against different roots:
|
|
30
|
+
*
|
|
31
|
+
* · here, under `BaseAgentType` — resolved by `BaseAgentType.GetAgentTypeInstance` from
|
|
32
|
+
* `AIAgentType.DriverClass`, giving the turn-protocol behaviour;
|
|
33
|
+
* · in {@link HarnessAgentBase}, under `BaseAgent` — resolved by `AgentRunner` from the same
|
|
34
|
+
* column, giving the execution driver that substitutes a harness turn for a prompt call.
|
|
35
|
+
*
|
|
36
|
+
* That is the mechanism working as designed rather than an overload: `AgentRunner` already treats
|
|
37
|
+
* the agent type's `DriverClass` as a `BaseAgent` key and falls back to plain `BaseAgent` when the
|
|
38
|
+
* key is unregistered there, which is exactly why every Loop agent gets the base execution class
|
|
39
|
+
* today. Registering both makes one metadata column select both halves.
|
|
40
|
+
*
|
|
41
|
+
* The subtlety is worth stating because it is invisible at each registration site on its own: seeing
|
|
42
|
+
* only this file, a reader would reasonably assume `'HarnessAgentType'` names one class.
|
|
43
|
+
*/
|
|
44
|
+
let HarnessAgentType = class HarnessAgentType extends LoopAgentType {
|
|
45
|
+
};
|
|
46
|
+
HarnessAgentType = __decorate([
|
|
47
|
+
RegisterClass(BaseAgentType, 'HarnessAgentType')
|
|
48
|
+
], HarnessAgentType);
|
|
49
|
+
export { HarnessAgentType };
|
|
50
|
+
//# sourceMappingURL=HarnessAgentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HarnessAgentType.js","sourceRoot":"","sources":["../src/HarnessAgentType.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,aAAa;CASlD,CAAA;AATY,gBAAgB;IAD5B,aAAa,CAAC,aAAa,EAAE,kBAAkB,CAAC;GACpC,gBAAgB,CAS5B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { BaseHarnessAdapter } from './BaseHarnessAdapter.js';
|
|
2
|
+
import { HarnessSessionConfig, HarnessTurnEvent } from '../types.js';
|
|
3
|
+
import { HarnessProcess } from '../sandbox/SandboxExecutor.js';
|
|
4
|
+
/**
|
|
5
|
+
* One line of JSON emitted by a harness CLI, before the adapter interprets it.
|
|
6
|
+
*
|
|
7
|
+
* Typed as an index signature rather than a concrete shape because the whole point of this class is
|
|
8
|
+
* that each vendor's event vocabulary differs — {@link BaseCliHarnessAdapter.MapEvent} is where a
|
|
9
|
+
* subclass turns vendor noise into the closed {@link HarnessTurnEvent} set.
|
|
10
|
+
*/
|
|
11
|
+
export type HarnessCliRawEvent = Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Shared driver for harnesses that expose themselves as a CLI emitting newline-delimited JSON.
|
|
14
|
+
*
|
|
15
|
+
* That covers most of the ecosystem — Codex, OpenCode, Gemini CLI and Pi all work this way, and only
|
|
16
|
+
* Claude Code ships a real TypeScript SDK. Rather than repeat process management, line framing and
|
|
17
|
+
* lifecycle in four adapters, subclasses supply just the two things that genuinely differ:
|
|
18
|
+
* {@link BuildTurnArgs} (how to phrase this turn on the command line) and {@link MapEvent} (what the
|
|
19
|
+
* vendor's JSON means).
|
|
20
|
+
*
|
|
21
|
+
* ## Process-per-turn, not process-per-session
|
|
22
|
+
*
|
|
23
|
+
* These CLIs are built to be invoked, do a unit of work, and exit — continuity comes from a session
|
|
24
|
+
* id passed back on the next invocation, not from a long-lived process. Modelling it that way keeps
|
|
25
|
+
* the adapter honest about what actually persists: if the harness cannot resume
|
|
26
|
+
* (`CapabilitySettings.SessionResume` false) the subclass must replay context into the next
|
|
27
|
+
* invocation itself, and report the extra tokens through a `usage` event so the run's cost guardrail
|
|
28
|
+
* sees the true spend rather than a flattering one.
|
|
29
|
+
*
|
|
30
|
+
* ## Placement is the sandbox's job, not the adapter's
|
|
31
|
+
*
|
|
32
|
+
* Every process goes through `config.Executor`, never `spawn` directly. That is what lets the same
|
|
33
|
+
* adapter run on a developer's laptop and inside a per-run container without knowing the difference,
|
|
34
|
+
* and it is what stops a production deployment from executing an autonomous agent's shell commands
|
|
35
|
+
* inside the MJAPI container while the agent's config claims `provider: 'docker'`.
|
|
36
|
+
*
|
|
37
|
+
* ## Failure is an event, not an exception
|
|
38
|
+
*
|
|
39
|
+
* A non-zero exit or unparseable stream yields a `session-error` event rather than a throw, because
|
|
40
|
+
* the caller's accumulation loop needs exactly one terminal event per turn to make progress. A throw
|
|
41
|
+
* from inside the async iterator would strand the run between turns with no recorded reason.
|
|
42
|
+
*/
|
|
43
|
+
export declare abstract class BaseCliHarnessAdapter extends BaseHarnessAdapter {
|
|
44
|
+
protected config: HarnessSessionConfig | null;
|
|
45
|
+
protected sessionId: string | undefined;
|
|
46
|
+
protected activeProcess: HarnessProcess | null;
|
|
47
|
+
private turnCount;
|
|
48
|
+
/** Absolute path or bare command name of the harness binary. */
|
|
49
|
+
protected abstract get ExecutablePath(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Builds the argv for one turn.
|
|
52
|
+
*
|
|
53
|
+
* @param input Task prompt on the first turn; formatted step results afterwards.
|
|
54
|
+
* @param isFirstTurn Lets a subclass choose between "start" and "resume" argument forms.
|
|
55
|
+
*/
|
|
56
|
+
protected abstract BuildTurnArgs(input: string, isFirstTurn: boolean): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Interprets one line of the harness's JSON stream.
|
|
59
|
+
*
|
|
60
|
+
* Return `null` for lines that carry no meaning for MJ — heartbeats, progress spinners, internal
|
|
61
|
+
* bookkeeping. Returning null is normal and expected; it is not an error path.
|
|
62
|
+
*/
|
|
63
|
+
protected abstract MapEvent(raw: HarnessCliRawEvent): HarnessTurnEvent | null;
|
|
64
|
+
/** @inheritdoc */
|
|
65
|
+
get SessionId(): string | undefined;
|
|
66
|
+
/** @inheritdoc */
|
|
67
|
+
StartSession(config: HarnessSessionConfig): Promise<void>;
|
|
68
|
+
/** @inheritdoc */
|
|
69
|
+
RunTurn(input: string): AsyncIterable<HarnessTurnEvent>;
|
|
70
|
+
/** @inheritdoc */
|
|
71
|
+
RespondToPermission(_requestId: string, _approved: boolean, _note?: string): Promise<void>;
|
|
72
|
+
/** @inheritdoc */
|
|
73
|
+
EndSession(): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Starts one turn's process INSIDE THE SANDBOX.
|
|
76
|
+
*
|
|
77
|
+
* Note what this does not do: call `spawn`. Where the process physically runs is the sandbox
|
|
78
|
+
* provider's decision, delivered through the executor, so this adapter behaves identically on a
|
|
79
|
+
* laptop and in a per-run container.
|
|
80
|
+
*/
|
|
81
|
+
protected startTurnProcess(input: string, isFirstTurn: boolean): HarnessProcess;
|
|
82
|
+
/** Frames stdout into lines, parses each as JSON, and maps it through the subclass. */
|
|
83
|
+
protected readEvents(proc: HarnessProcess): AsyncIterable<HarnessTurnEvent>;
|
|
84
|
+
/** Narrows an unknown catch binding to a readable message without reaching for `any`. */
|
|
85
|
+
protected describeError(e: unknown): string;
|
|
86
|
+
/** Reads a string field from a raw event, or undefined when absent/not a string. */
|
|
87
|
+
protected readString(raw: HarnessCliRawEvent, key: string): string | undefined;
|
|
88
|
+
/** Reads a numeric field from a raw event, or undefined when absent/not a number. */
|
|
89
|
+
protected readNumber(raw: HarnessCliRawEvent, key: string): number | undefined;
|
|
90
|
+
/** Reads a nested object from a raw event, or undefined when absent/not an object. */
|
|
91
|
+
protected readObject(raw: HarnessCliRawEvent, key: string): HarnessCliRawEvent | undefined;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=BaseCliHarnessAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCliHarnessAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/BaseCliHarnessAdapter.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AMvG,kBAAkB;IACL,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxC;;;;;;OAMG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,cAAc;IAW/E,uFAAuF;cACtE,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC,gBAAgB,CAAC;IA+BlF,yFAAyF;IACzF,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM;IAI3C,oFAAoF;IACpF,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK9E,qFAAqF;IACrF,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK9E,sFAAsF;IACtF,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;CAM7F"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { LogError, LogStatus } from '@memberjunction/core';
|
|
2
|
+
import { BaseHarnessAdapter } from './BaseHarnessAdapter.js';
|
|
3
|
+
/**
|
|
4
|
+
* Shared driver for harnesses that expose themselves as a CLI emitting newline-delimited JSON.
|
|
5
|
+
*
|
|
6
|
+
* That covers most of the ecosystem — Codex, OpenCode, Gemini CLI and Pi all work this way, and only
|
|
7
|
+
* Claude Code ships a real TypeScript SDK. Rather than repeat process management, line framing and
|
|
8
|
+
* lifecycle in four adapters, subclasses supply just the two things that genuinely differ:
|
|
9
|
+
* {@link BuildTurnArgs} (how to phrase this turn on the command line) and {@link MapEvent} (what the
|
|
10
|
+
* vendor's JSON means).
|
|
11
|
+
*
|
|
12
|
+
* ## Process-per-turn, not process-per-session
|
|
13
|
+
*
|
|
14
|
+
* These CLIs are built to be invoked, do a unit of work, and exit — continuity comes from a session
|
|
15
|
+
* id passed back on the next invocation, not from a long-lived process. Modelling it that way keeps
|
|
16
|
+
* the adapter honest about what actually persists: if the harness cannot resume
|
|
17
|
+
* (`CapabilitySettings.SessionResume` false) the subclass must replay context into the next
|
|
18
|
+
* invocation itself, and report the extra tokens through a `usage` event so the run's cost guardrail
|
|
19
|
+
* sees the true spend rather than a flattering one.
|
|
20
|
+
*
|
|
21
|
+
* ## Placement is the sandbox's job, not the adapter's
|
|
22
|
+
*
|
|
23
|
+
* Every process goes through `config.Executor`, never `spawn` directly. That is what lets the same
|
|
24
|
+
* adapter run on a developer's laptop and inside a per-run container without knowing the difference,
|
|
25
|
+
* and it is what stops a production deployment from executing an autonomous agent's shell commands
|
|
26
|
+
* inside the MJAPI container while the agent's config claims `provider: 'docker'`.
|
|
27
|
+
*
|
|
28
|
+
* ## Failure is an event, not an exception
|
|
29
|
+
*
|
|
30
|
+
* A non-zero exit or unparseable stream yields a `session-error` event rather than a throw, because
|
|
31
|
+
* the caller's accumulation loop needs exactly one terminal event per turn to make progress. A throw
|
|
32
|
+
* from inside the async iterator would strand the run between turns with no recorded reason.
|
|
33
|
+
*/
|
|
34
|
+
export class BaseCliHarnessAdapter extends BaseHarnessAdapter {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.config = null;
|
|
38
|
+
this.sessionId = undefined;
|
|
39
|
+
this.activeProcess = null;
|
|
40
|
+
this.turnCount = 0;
|
|
41
|
+
}
|
|
42
|
+
/** @inheritdoc */
|
|
43
|
+
get SessionId() {
|
|
44
|
+
return this.sessionId;
|
|
45
|
+
}
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
async StartSession(config) {
|
|
48
|
+
this.config = config;
|
|
49
|
+
this.turnCount = 0;
|
|
50
|
+
LogStatus(`Harness CLI session starting: ${this.ExecutablePath} (workspace: ${config.WorkspacePath})`);
|
|
51
|
+
}
|
|
52
|
+
/** @inheritdoc */
|
|
53
|
+
async *RunTurn(input) {
|
|
54
|
+
if (!this.config) {
|
|
55
|
+
yield { Type: 'session-error', Error: 'RunTurn called before StartSession' };
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const isFirstTurn = this.turnCount === 0;
|
|
59
|
+
this.turnCount++;
|
|
60
|
+
let proc;
|
|
61
|
+
try {
|
|
62
|
+
proc = this.startTurnProcess(input, isFirstTurn);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
yield { Type: 'session-error', Error: `Failed to launch ${this.ExecutablePath}: ${this.describeError(e)}` };
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.activeProcess = proc;
|
|
69
|
+
const stderrChunks = [];
|
|
70
|
+
const drainStderr = (async () => {
|
|
71
|
+
for await (const line of proc.Stderr) {
|
|
72
|
+
stderrChunks.push(line);
|
|
73
|
+
}
|
|
74
|
+
})().catch(() => undefined);
|
|
75
|
+
let sawTerminal = false;
|
|
76
|
+
try {
|
|
77
|
+
for await (const event of this.readEvents(proc)) {
|
|
78
|
+
if (event.Type === 'turn-complete' || event.Type === 'session-error') {
|
|
79
|
+
sawTerminal = true;
|
|
80
|
+
}
|
|
81
|
+
yield event;
|
|
82
|
+
}
|
|
83
|
+
// Exactly one terminal event per turn is the contract the accumulation loop relies on.
|
|
84
|
+
// A clean stream that never produced one means the harness exited without answering --
|
|
85
|
+
// surface it rather than letting the caller wait on a turn that already ended.
|
|
86
|
+
if (!sawTerminal) {
|
|
87
|
+
const exit = await proc.ExitCode;
|
|
88
|
+
await drainStderr;
|
|
89
|
+
const detail = stderrChunks.join('\n').trim();
|
|
90
|
+
yield {
|
|
91
|
+
Type: 'session-error',
|
|
92
|
+
Error: `${this.ExecutablePath} exited (code ${exit}) without emitting a turn result` +
|
|
93
|
+
(detail ? `: ${detail.slice(0, 2000)}` : ''),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
this.activeProcess = null;
|
|
99
|
+
proc.Kill();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** @inheritdoc */
|
|
103
|
+
async RespondToPermission(_requestId, _approved, _note) {
|
|
104
|
+
// CLI harnesses that lack permission hooks have nothing to answer. Deliberately a no-op
|
|
105
|
+
// rather than a throw: the posture layer may call this defensively, and turning a
|
|
106
|
+
// capability gap into an exception would fail runs that are behaving correctly.
|
|
107
|
+
}
|
|
108
|
+
/** @inheritdoc */
|
|
109
|
+
async EndSession() {
|
|
110
|
+
const proc = this.activeProcess;
|
|
111
|
+
this.activeProcess = null;
|
|
112
|
+
this.config = null;
|
|
113
|
+
proc?.Kill();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Starts one turn's process INSIDE THE SANDBOX.
|
|
117
|
+
*
|
|
118
|
+
* Note what this does not do: call `spawn`. Where the process physically runs is the sandbox
|
|
119
|
+
* provider's decision, delivered through the executor, so this adapter behaves identically on a
|
|
120
|
+
* laptop and in a per-run container.
|
|
121
|
+
*/
|
|
122
|
+
startTurnProcess(input, isFirstTurn) {
|
|
123
|
+
const config = this.config;
|
|
124
|
+
return config.Executor.Run({
|
|
125
|
+
Command: this.ExecutablePath,
|
|
126
|
+
Args: this.BuildTurnArgs(input, isFirstTurn),
|
|
127
|
+
Environment: config.Environment,
|
|
128
|
+
WorkingDirectory: config.WorkspacePath,
|
|
129
|
+
CancellationToken: config.CancellationToken,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Frames stdout into lines, parses each as JSON, and maps it through the subclass. */
|
|
133
|
+
async *readEvents(proc) {
|
|
134
|
+
for await (const line of proc.Stdout) {
|
|
135
|
+
const trimmed = line.trim();
|
|
136
|
+
if (!trimmed) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
let raw;
|
|
140
|
+
try {
|
|
141
|
+
raw = JSON.parse(trimmed);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Harness CLIs interleave human-readable banners with their JSON stream. A line that
|
|
145
|
+
// does not parse is noise, not a failure -- logging every one would bury the real
|
|
146
|
+
// events, so this is intentionally silent.
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
let mapped;
|
|
150
|
+
try {
|
|
151
|
+
mapped = this.MapEvent(raw);
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
LogError(`Harness adapter failed to map event: ${this.describeError(e)}`);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (mapped) {
|
|
158
|
+
yield mapped;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** Narrows an unknown catch binding to a readable message without reaching for `any`. */
|
|
163
|
+
describeError(e) {
|
|
164
|
+
return e instanceof Error ? e.message : String(e);
|
|
165
|
+
}
|
|
166
|
+
/** Reads a string field from a raw event, or undefined when absent/not a string. */
|
|
167
|
+
readString(raw, key) {
|
|
168
|
+
const value = raw[key];
|
|
169
|
+
return typeof value === 'string' ? value : undefined;
|
|
170
|
+
}
|
|
171
|
+
/** Reads a numeric field from a raw event, or undefined when absent/not a number. */
|
|
172
|
+
readNumber(raw, key) {
|
|
173
|
+
const value = raw[key];
|
|
174
|
+
return typeof value === 'number' ? value : undefined;
|
|
175
|
+
}
|
|
176
|
+
/** Reads a nested object from a raw event, or undefined when absent/not an object. */
|
|
177
|
+
readObject(raw, key) {
|
|
178
|
+
const value = raw[key];
|
|
179
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
180
|
+
? value
|
|
181
|
+
: undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=BaseCliHarnessAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCliHarnessAdapter.js","sourceRoot":"","sources":["../../src/adapters/BaseCliHarnessAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,E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
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { HarnessCapabilities, HarnessPermissionPolicy, HarnessSessionConfig, HarnessTurnEvent } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The contract every external agent harness is driven through.
|
|
4
|
+
*
|
|
5
|
+
* Adapters register with `@RegisterClass(BaseHarnessAdapter, '<DriverClass>')` and are resolved from
|
|
6
|
+
* `AIAgentHarness.DriverClass`, so a customer can ship a proprietary adapter without forking core —
|
|
7
|
+
* the same extension mechanism AI model vendor drivers already use.
|
|
8
|
+
*
|
|
9
|
+
* ## Why this interface is turn-oriented rather than session-oriented
|
|
10
|
+
*
|
|
11
|
+
* A harness turn is protocol-identical to a Loop agent's prompt iteration: the harness reasons, then
|
|
12
|
+
* ends its turn by emitting the Loop next-step JSON envelope. MJ executes any actions, sub-agents or
|
|
13
|
+
* skills that envelope asks for through its OWN validated machinery, then resumes the session with
|
|
14
|
+
* the results. That is the whole reason the harness plugs into `BaseAgent`'s existing loop instead of
|
|
15
|
+
* running beside it — every guardrail, payload ACL, HITL gate and accounting path applies unchanged.
|
|
16
|
+
*
|
|
17
|
+
* So {@link RunTurn} is the unit of work, not `Run`. The first call carries the task prompt; every
|
|
18
|
+
* later call carries formatted step results.
|
|
19
|
+
*
|
|
20
|
+
* ## Capability honesty
|
|
21
|
+
*
|
|
22
|
+
* {@link Capabilities} must describe what the adapter ACTUALLY implements, not what the underlying
|
|
23
|
+
* harness advertises. The runtime gates behaviour on these flags and emulates what is missing —
|
|
24
|
+
* claiming a capability that is not wired up produces a silent behavioural gap rather than an error,
|
|
25
|
+
* which is the failure mode this whole feature is trying to avoid elsewhere.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class BaseHarnessAdapter {
|
|
28
|
+
/**
|
|
29
|
+
* Launches the harness session. Called once per run, before the first turn.
|
|
30
|
+
*
|
|
31
|
+
* Implementations must not begin reasoning here — only establish the process, workspace and
|
|
32
|
+
* credentials. Any failure should throw, so the run fails visibly rather than proceeding with a
|
|
33
|
+
* half-built session.
|
|
34
|
+
*/
|
|
35
|
+
abstract StartSession(config: HarnessSessionConfig): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Runs one turn and streams what happens.
|
|
38
|
+
*
|
|
39
|
+
* The first call receives the task prompt; subsequent calls receive formatted results of steps MJ
|
|
40
|
+
* executed on the harness's behalf. Implementations MUST emit exactly one terminal event —
|
|
41
|
+
* `turn-complete` or `session-error` — so the caller's accumulation loop always terminates.
|
|
42
|
+
*
|
|
43
|
+
* Where the harness cannot resume a session natively (`SessionResume` false), the adapter is
|
|
44
|
+
* responsible for replaying prior context into a fresh invocation here, and for reporting the
|
|
45
|
+
* resulting token cost through `usage` so the run's guardrails see the true spend.
|
|
46
|
+
*/
|
|
47
|
+
abstract RunTurn(input: string): AsyncIterable<HarnessTurnEvent>;
|
|
48
|
+
/**
|
|
49
|
+
* Supplies MJ's system prompt for the session, where the harness can accept one.
|
|
50
|
+
*
|
|
51
|
+
* Harnesses ship their own system prompt defining their identity, and it dominates anything sent
|
|
52
|
+
* as user text. MJ's turn-end contract delivered as a user message therefore competes with the
|
|
53
|
+
* harness's own instructions and loses — observed directly: a harness given the contract in the
|
|
54
|
+
* user turn still answered "what can you do?" in prose, costing a retry every run.
|
|
55
|
+
*
|
|
56
|
+
* Adapters whose harness accepts a system prompt SHOULD override this. Those that cannot are no
|
|
57
|
+
* worse off than before: the contract still rides in the turn input.
|
|
58
|
+
*/
|
|
59
|
+
SetSystemPrompt(_systemPrompt: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Answers a `permission-request` the adapter raised.
|
|
62
|
+
*
|
|
63
|
+
* Only meaningful when {@link Capabilities}.PermissionHooks is true; adapters without hooks
|
|
64
|
+
* should treat this as a no-op rather than throwing, because the posture layer above may still
|
|
65
|
+
* call it defensively.
|
|
66
|
+
*/
|
|
67
|
+
abstract RespondToPermission(requestId: string, approved: boolean, note?: string): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Tears the session down.
|
|
70
|
+
*
|
|
71
|
+
* MUST be idempotent and MUST be safe to call on every exit path — success, failure,
|
|
72
|
+
* cancellation and crash — because it is what revokes the per-run MCP credential and releases the
|
|
73
|
+
* workspace. A teardown that only runs on the happy path leaks a live credential.
|
|
74
|
+
*/
|
|
75
|
+
abstract EndSession(): Promise<void>;
|
|
76
|
+
/** What this adapter actually supports. See the class doc on capability honesty. */
|
|
77
|
+
abstract get Capabilities(): HarnessCapabilities;
|
|
78
|
+
/** Vendor session id once known, persisted to `AIAgentRun.ExternalSessionID`. */
|
|
79
|
+
get SessionId(): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Translates MJ's permission policy into whatever this harness understands.
|
|
82
|
+
*
|
|
83
|
+
* Overridable and default no-op, matching the other capability seams. An adapter that cannot
|
|
84
|
+
* enforce permissions should leave this alone AND report `PermissionHooks: false`, so the
|
|
85
|
+
* runtime knows the policy is advisory rather than enforced. Silently accepting a policy you
|
|
86
|
+
* cannot apply is the worst option: the operator believes `strict` is gating something.
|
|
87
|
+
*
|
|
88
|
+
* Called once, before {@link StartSession}, so adapters can fold the result into launch flags.
|
|
89
|
+
*/
|
|
90
|
+
ApplyPermissionPolicy(_policy: HarnessPermissionPolicy): void;
|
|
91
|
+
/**
|
|
92
|
+
* Whether this session actually continued {@link HarnessSessionConfig.ResumeSessionId}.
|
|
93
|
+
*
|
|
94
|
+
* Default false: a harness that cannot resume, or one offered no prior session, starts cold and
|
|
95
|
+
* must be sent the full conversation. Adapters that DO resume MUST override this and report
|
|
96
|
+
* truthfully — the caller sends only the newest message when it returns true, so a false
|
|
97
|
+
* positive leaves the harness answering a question it never saw the context for.
|
|
98
|
+
*
|
|
99
|
+
* Deliberately separate from `CapabilitySettings.SessionResume`. That flag says the adapter CAN
|
|
100
|
+
* resume in principle; this says it DID, this time. A stale or pruned session id makes the two
|
|
101
|
+
* disagree, and only the second one is safe to branch the turn input on.
|
|
102
|
+
*/
|
|
103
|
+
get DidResumeSession(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The model the harness actually used, if it reports one.
|
|
106
|
+
*
|
|
107
|
+
* Adapters that can observe this SHOULD override it. Accounting resolves `AIPromptRun.ModelID`
|
|
108
|
+
* from this first and only falls back to the harness row's declared model, because a harness left
|
|
109
|
+
* to choose its own model will — and billing a run against a model it never used is worse than
|
|
110
|
+
* having no attribution at all, since it looks authoritative.
|
|
111
|
+
*/
|
|
112
|
+
get ReportedModel(): string | undefined;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=BaseHarnessAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseHarnessAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/BaseHarnessAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,8BAAsB,kBAAkB;IACpC;;;;;;OAMG;aACa,YAAY,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAEzE;;;;;;;;;;OAUG;aACa,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC;IAEvE;;;;;;;;;;OAUG;IACI,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAInD;;;;;;OAMG;aACa,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvG;;;;;;OAMG;aACa,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3C,oFAAoF;IACpF,aAAoB,YAAY,IAAI,mBAAmB,CAAC;IAExD,iFAAiF;IACjF,IAAW,SAAS,IAAI,MAAM,GAAG,SAAS,CAEzC;IAED;;;;;;;;;OASG;IACI,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAKpE;;;;;;;;;;;OAWG;IACH,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAED;;;;;;;OAOG;IACH,IAAW,aAAa,IAAI,MAAM,GAAG,SAAS,CAE7C;CACJ"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract every external agent harness is driven through.
|
|
3
|
+
*
|
|
4
|
+
* Adapters register with `@RegisterClass(BaseHarnessAdapter, '<DriverClass>')` and are resolved from
|
|
5
|
+
* `AIAgentHarness.DriverClass`, so a customer can ship a proprietary adapter without forking core —
|
|
6
|
+
* the same extension mechanism AI model vendor drivers already use.
|
|
7
|
+
*
|
|
8
|
+
* ## Why this interface is turn-oriented rather than session-oriented
|
|
9
|
+
*
|
|
10
|
+
* A harness turn is protocol-identical to a Loop agent's prompt iteration: the harness reasons, then
|
|
11
|
+
* ends its turn by emitting the Loop next-step JSON envelope. MJ executes any actions, sub-agents or
|
|
12
|
+
* skills that envelope asks for through its OWN validated machinery, then resumes the session with
|
|
13
|
+
* the results. That is the whole reason the harness plugs into `BaseAgent`'s existing loop instead of
|
|
14
|
+
* running beside it — every guardrail, payload ACL, HITL gate and accounting path applies unchanged.
|
|
15
|
+
*
|
|
16
|
+
* So {@link RunTurn} is the unit of work, not `Run`. The first call carries the task prompt; every
|
|
17
|
+
* later call carries formatted step results.
|
|
18
|
+
*
|
|
19
|
+
* ## Capability honesty
|
|
20
|
+
*
|
|
21
|
+
* {@link Capabilities} must describe what the adapter ACTUALLY implements, not what the underlying
|
|
22
|
+
* harness advertises. The runtime gates behaviour on these flags and emulates what is missing —
|
|
23
|
+
* claiming a capability that is not wired up produces a silent behavioural gap rather than an error,
|
|
24
|
+
* which is the failure mode this whole feature is trying to avoid elsewhere.
|
|
25
|
+
*/
|
|
26
|
+
export class BaseHarnessAdapter {
|
|
27
|
+
/**
|
|
28
|
+
* Supplies MJ's system prompt for the session, where the harness can accept one.
|
|
29
|
+
*
|
|
30
|
+
* Harnesses ship their own system prompt defining their identity, and it dominates anything sent
|
|
31
|
+
* as user text. MJ's turn-end contract delivered as a user message therefore competes with the
|
|
32
|
+
* harness's own instructions and loses — observed directly: a harness given the contract in the
|
|
33
|
+
* user turn still answered "what can you do?" in prose, costing a retry every run.
|
|
34
|
+
*
|
|
35
|
+
* Adapters whose harness accepts a system prompt SHOULD override this. Those that cannot are no
|
|
36
|
+
* worse off than before: the contract still rides in the turn input.
|
|
37
|
+
*/
|
|
38
|
+
SetSystemPrompt(_systemPrompt) {
|
|
39
|
+
// Default: unsupported, and deliberately not an error.
|
|
40
|
+
}
|
|
41
|
+
/** Vendor session id once known, persisted to `AIAgentRun.ExternalSessionID`. */
|
|
42
|
+
get SessionId() {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Translates MJ's permission policy into whatever this harness understands.
|
|
47
|
+
*
|
|
48
|
+
* Overridable and default no-op, matching the other capability seams. An adapter that cannot
|
|
49
|
+
* enforce permissions should leave this alone AND report `PermissionHooks: false`, so the
|
|
50
|
+
* runtime knows the policy is advisory rather than enforced. Silently accepting a policy you
|
|
51
|
+
* cannot apply is the worst option: the operator believes `strict` is gating something.
|
|
52
|
+
*
|
|
53
|
+
* Called once, before {@link StartSession}, so adapters can fold the result into launch flags.
|
|
54
|
+
*/
|
|
55
|
+
ApplyPermissionPolicy(_policy) {
|
|
56
|
+
// Default: unsupported. See the note above on why this is silent but paired with a false
|
|
57
|
+
// PermissionHooks capability rather than throwing.
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether this session actually continued {@link HarnessSessionConfig.ResumeSessionId}.
|
|
61
|
+
*
|
|
62
|
+
* Default false: a harness that cannot resume, or one offered no prior session, starts cold and
|
|
63
|
+
* must be sent the full conversation. Adapters that DO resume MUST override this and report
|
|
64
|
+
* truthfully — the caller sends only the newest message when it returns true, so a false
|
|
65
|
+
* positive leaves the harness answering a question it never saw the context for.
|
|
66
|
+
*
|
|
67
|
+
* Deliberately separate from `CapabilitySettings.SessionResume`. That flag says the adapter CAN
|
|
68
|
+
* resume in principle; this says it DID, this time. A stale or pruned session id makes the two
|
|
69
|
+
* disagree, and only the second one is safe to branch the turn input on.
|
|
70
|
+
*/
|
|
71
|
+
get DidResumeSession() {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The model the harness actually used, if it reports one.
|
|
76
|
+
*
|
|
77
|
+
* Adapters that can observe this SHOULD override it. Accounting resolves `AIPromptRun.ModelID`
|
|
78
|
+
* from this first and only falls back to the harness row's declared model, because a harness left
|
|
79
|
+
* to choose its own model will — and billing a run against a model it never used is worse than
|
|
80
|
+
* having no attribution at all, since it looks authoritative.
|
|
81
|
+
*/
|
|
82
|
+
get ReportedModel() {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=BaseHarnessAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseHarnessAdapter.js","sourceRoot":"","sources":["../../src/adapters/BaseHarnessAdapter.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAgB,kBAAkB;IAuBpC;;;;;;;;;;OAUG;IACI,eAAe,CAAC,aAAqB;QACxC,uDAAuD;IAC3D,CAAC;IAuBD,iFAAiF;IACjF,IAAW,SAAS;QAChB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;;;;;;;;OASG;IACI,qBAAqB,CAAC,OAAgC;QACzD,yFAAyF;QACzF,mDAAmD;IACvD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAW,gBAAgB;QACvB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;;OAOG;IACH,IAAW,aAAa;QACpB,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ"}
|