ai4ai 0.0.3 → 0.0.6
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/README.md +6 -0
- package/README.zh-CN.md +6 -0
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/dist/adapters/claude/adapter.d.ts +10 -1
- package/claude-plugin/dist/adapters/claude/adapter.js +35 -10
- package/claude-plugin/dist/adapters/claude/journal.d.ts +8 -0
- package/claude-plugin/dist/adapters/claude/journal.js +4 -1
- package/claude-plugin/dist/adapters/claude/plugin.js +254 -107
- package/claude-plugin/dist/adapters/claude/worker.js +30 -8
- package/claude-plugin/dist/adapters/codex/adapter.d.ts +26 -19
- package/claude-plugin/dist/adapters/codex/adapter.js +283 -187
- package/claude-plugin/dist/adapters/codex/app-server.js +1 -1
- package/claude-plugin/dist/adapters/codex/control.d.ts +36 -1
- package/claude-plugin/dist/adapters/codex/control.js +74 -4
- package/claude-plugin/dist/adapters/codex/native-handoff.d.ts +60 -0
- package/claude-plugin/dist/adapters/codex/native-handoff.js +138 -0
- package/claude-plugin/dist/adapters/codex/runner.js +35 -32
- package/claude-plugin/dist/adapters/codex/tui-daemon-watch.js +60 -49
- package/claude-plugin/dist/adapters/declarations.d.ts +0 -1
- package/claude-plugin/dist/adapters/declarations.js +0 -1
- package/claude-plugin/dist/adapters/dsh/adapter.d.ts +39 -2
- package/claude-plugin/dist/adapters/dsh/adapter.js +164 -37
- package/claude-plugin/dist/adapters/dsh/plugin.d.ts +3 -1
- package/claude-plugin/dist/adapters/dsh/plugin.js +33 -22
- package/claude-plugin/dist/adapters/executors.d.ts +25 -2
- package/claude-plugin/dist/adapters/executors.js +58 -4
- package/claude-plugin/dist/adapters/external.d.ts +21 -0
- package/claude-plugin/dist/adapters/external.js +128 -18
- package/claude-plugin/dist/adapters/opencode/adapter.d.ts +13 -2
- package/claude-plugin/dist/adapters/opencode/adapter.js +53 -10
- package/claude-plugin/dist/adapters/opencode/journal.d.ts +2 -0
- package/claude-plugin/dist/adapters/opencode/journal.js +12 -4
- package/claude-plugin/dist/adapters/opencode/plugin.d.ts +3 -5
- package/claude-plugin/dist/adapters/opencode/plugin.js +3 -292
- package/claude-plugin/dist/adapters/opencode/setup.d.ts +9 -0
- package/claude-plugin/dist/adapters/opencode/setup.js +350 -0
- package/claude-plugin/dist/adapters/supervisor.js +64 -20
- package/claude-plugin/dist/adapters/types.d.ts +7 -0
- package/claude-plugin/dist/contract/schema.d.ts +8 -17
- package/claude-plugin/dist/contract/schema.js +3 -4
- package/claude-plugin/dist/contract/states.d.ts +11 -0
- package/claude-plugin/dist/contract/states.js +9 -0
- package/claude-plugin/dist/contract/types.d.ts +3 -3
- package/claude-plugin/dist/contract/validate.js +24 -14
- package/claude-plugin/dist/contract/version.d.ts +1 -1
- package/claude-plugin/dist/contract/version.js +1 -1
- package/claude-plugin/dist/core/dsh-selection.d.ts +43 -0
- package/claude-plugin/dist/core/dsh-selection.js +78 -0
- package/claude-plugin/dist/core/handoff.d.ts +42 -0
- package/claude-plugin/dist/core/handoff.js +63 -0
- package/claude-plugin/dist/core/index.d.ts +2 -0
- package/claude-plugin/dist/core/index.js +1 -0
- package/claude-plugin/dist/core/operations.js +33 -1
- package/claude-plugin/dist/core/retained-input.d.ts +24 -0
- package/claude-plugin/dist/core/retained-input.js +50 -0
- package/claude-plugin/dist/core/session-probe.js +11 -22
- package/claude-plugin/dist/core/store.d.ts +8 -3
- package/claude-plugin/dist/core/store.js +17 -3
- package/claude-plugin/request-schema.json +1 -2
- package/dist/adapters/claude/adapter.d.ts +10 -1
- package/dist/adapters/claude/adapter.js +35 -10
- package/dist/adapters/claude/journal.d.ts +8 -0
- package/dist/adapters/claude/journal.js +4 -1
- package/dist/adapters/claude/plugin.js +254 -107
- package/dist/adapters/claude/worker.js +30 -8
- package/dist/adapters/codex/adapter.d.ts +26 -19
- package/dist/adapters/codex/adapter.js +283 -187
- package/dist/adapters/codex/app-server.js +1 -1
- package/dist/adapters/codex/control.d.ts +36 -1
- package/dist/adapters/codex/control.js +74 -4
- package/dist/adapters/codex/native-handoff.d.ts +60 -0
- package/dist/adapters/codex/native-handoff.js +138 -0
- package/dist/adapters/codex/runner.js +35 -32
- package/dist/adapters/codex/tui-daemon-watch.js +60 -49
- package/dist/adapters/declarations.d.ts +0 -1
- package/dist/adapters/declarations.js +0 -1
- package/dist/adapters/dsh/adapter.d.ts +39 -2
- package/dist/adapters/dsh/adapter.js +164 -37
- package/dist/adapters/dsh/plugin.d.ts +3 -1
- package/dist/adapters/dsh/plugin.js +33 -22
- package/dist/adapters/executors.d.ts +25 -2
- package/dist/adapters/executors.js +58 -4
- package/dist/adapters/external.d.ts +21 -0
- package/dist/adapters/external.js +128 -18
- package/dist/adapters/opencode/adapter.d.ts +13 -2
- package/dist/adapters/opencode/adapter.js +53 -10
- package/dist/adapters/opencode/journal.d.ts +2 -0
- package/dist/adapters/opencode/journal.js +12 -4
- package/dist/adapters/opencode/plugin.d.ts +3 -5
- package/dist/adapters/opencode/plugin.js +3 -292
- package/dist/adapters/opencode/setup.d.ts +9 -0
- package/dist/adapters/opencode/setup.js +350 -0
- package/dist/adapters/supervisor.js +64 -20
- package/dist/adapters/types.d.ts +7 -0
- package/dist/contract/schema.d.ts +8 -17
- package/dist/contract/schema.js +3 -4
- package/dist/contract/states.d.ts +11 -0
- package/dist/contract/states.js +9 -0
- package/dist/contract/types.d.ts +3 -3
- package/dist/contract/validate.js +24 -14
- package/dist/contract/version.d.ts +1 -1
- package/dist/contract/version.js +1 -1
- package/dist/core/dsh-selection.d.ts +43 -0
- package/dist/core/dsh-selection.js +78 -0
- package/dist/core/handoff.d.ts +42 -0
- package/dist/core/handoff.js +63 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +1 -0
- package/dist/core/operations.js +33 -1
- package/dist/core/retained-input.d.ts +24 -0
- package/dist/core/retained-input.js +50 -0
- package/dist/core/session-probe.js +11 -22
- package/dist/core/store.d.ts +8 -3
- package/dist/core/store.js +17 -3
- package/docs/contract.md +31 -15
- package/opencode-plugin/dist/adapters/claude/adapter.d.ts +10 -1
- package/opencode-plugin/dist/adapters/claude/adapter.js +35 -10
- package/opencode-plugin/dist/adapters/claude/journal.d.ts +8 -0
- package/opencode-plugin/dist/adapters/claude/journal.js +4 -1
- package/opencode-plugin/dist/adapters/claude/plugin.js +254 -107
- package/opencode-plugin/dist/adapters/claude/worker.js +30 -8
- package/opencode-plugin/dist/adapters/codex/adapter.d.ts +26 -19
- package/opencode-plugin/dist/adapters/codex/adapter.js +283 -187
- package/opencode-plugin/dist/adapters/codex/app-server.js +1 -1
- package/opencode-plugin/dist/adapters/codex/control.d.ts +36 -1
- package/opencode-plugin/dist/adapters/codex/control.js +74 -4
- package/opencode-plugin/dist/adapters/codex/native-handoff.d.ts +60 -0
- package/opencode-plugin/dist/adapters/codex/native-handoff.js +138 -0
- package/opencode-plugin/dist/adapters/codex/runner.js +35 -32
- package/opencode-plugin/dist/adapters/codex/tui-daemon-watch.js +60 -49
- package/opencode-plugin/dist/adapters/declarations.d.ts +0 -1
- package/opencode-plugin/dist/adapters/declarations.js +0 -1
- package/opencode-plugin/dist/adapters/dsh/adapter.d.ts +39 -2
- package/opencode-plugin/dist/adapters/dsh/adapter.js +164 -37
- package/opencode-plugin/dist/adapters/dsh/plugin.d.ts +3 -1
- package/opencode-plugin/dist/adapters/dsh/plugin.js +33 -22
- package/opencode-plugin/dist/adapters/executors.d.ts +25 -2
- package/opencode-plugin/dist/adapters/executors.js +58 -4
- package/opencode-plugin/dist/adapters/external.d.ts +21 -0
- package/opencode-plugin/dist/adapters/external.js +128 -18
- package/opencode-plugin/dist/adapters/opencode/adapter.d.ts +13 -2
- package/opencode-plugin/dist/adapters/opencode/adapter.js +53 -10
- package/opencode-plugin/dist/adapters/opencode/journal.d.ts +2 -0
- package/opencode-plugin/dist/adapters/opencode/journal.js +12 -4
- package/opencode-plugin/dist/adapters/opencode/plugin.d.ts +3 -5
- package/opencode-plugin/dist/adapters/opencode/plugin.js +3 -292
- package/opencode-plugin/dist/adapters/opencode/setup.d.ts +9 -0
- package/opencode-plugin/dist/adapters/opencode/setup.js +350 -0
- package/opencode-plugin/dist/adapters/supervisor.js +64 -20
- package/opencode-plugin/dist/adapters/types.d.ts +7 -0
- package/opencode-plugin/dist/contract/schema.d.ts +8 -17
- package/opencode-plugin/dist/contract/schema.js +3 -4
- package/opencode-plugin/dist/contract/states.d.ts +11 -0
- package/opencode-plugin/dist/contract/states.js +9 -0
- package/opencode-plugin/dist/contract/types.d.ts +3 -3
- package/opencode-plugin/dist/contract/validate.js +24 -14
- package/opencode-plugin/dist/contract/version.d.ts +1 -1
- package/opencode-plugin/dist/contract/version.js +1 -1
- package/opencode-plugin/dist/core/dsh-selection.d.ts +43 -0
- package/opencode-plugin/dist/core/dsh-selection.js +78 -0
- package/opencode-plugin/dist/core/handoff.d.ts +42 -0
- package/opencode-plugin/dist/core/handoff.js +63 -0
- package/opencode-plugin/dist/core/index.d.ts +2 -0
- package/opencode-plugin/dist/core/index.js +1 -0
- package/opencode-plugin/dist/core/operations.js +33 -1
- package/opencode-plugin/dist/core/retained-input.d.ts +24 -0
- package/opencode-plugin/dist/core/retained-input.js +50 -0
- package/opencode-plugin/dist/core/session-probe.js +11 -22
- package/opencode-plugin/dist/core/store.d.ts +8 -3
- package/opencode-plugin/dist/core/store.js +17 -3
- package/opencode-plugin/package.json +1 -1
- package/package.json +1 -1
- package/claude-plugin/dist/adapters/codex/tui-restart-watch.d.ts +0 -2
- package/claude-plugin/dist/adapters/codex/tui-restart-watch.js +0 -330
- package/claude-plugin/dist/tmux/backend.d.ts +0 -55
- package/claude-plugin/dist/tmux/backend.js +0 -161
- package/dist/adapters/codex/tui-restart-watch.d.ts +0 -2
- package/dist/adapters/codex/tui-restart-watch.js +0 -330
- package/dist/tmux/backend.d.ts +0 -55
- package/dist/tmux/backend.js +0 -161
- package/opencode-plugin/dist/adapters/codex/tui-restart-watch.d.ts +0 -2
- package/opencode-plugin/dist/adapters/codex/tui-restart-watch.js +0 -330
- package/opencode-plugin/dist/tmux/backend.d.ts +0 -55
- package/opencode-plugin/dist/tmux/backend.js +0 -161
package/README.md
CHANGED
|
@@ -45,4 +45,10 @@ Claude Code / OpenCode / DSH expose the tools after registration; Codex uses the
|
|
|
45
45
|
npx ai4ai session --operation status --harness codex
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### DeepSeek Harness Web
|
|
49
|
+
|
|
50
|
+
1. In DSH Web, open **Plugins** → **Add plugin** and choose `ai4ai`.
|
|
51
|
+
2. **Enable** the plugin.
|
|
52
|
+
3. Restart the DSH service the way you normally start it, then refresh the page.
|
|
53
|
+
|
|
48
54
|
Contract and details: [docs/contract.md](docs/contract.md). MIT.
|
package/README.zh-CN.md
CHANGED
|
@@ -45,4 +45,10 @@ Claude Code / OpenCode / DSH 注册后直接使用工具;Codex 用 CLI:
|
|
|
45
45
|
npx ai4ai session --operation status --harness codex
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### DeepSeek Harness Web
|
|
49
|
+
|
|
50
|
+
1. 在 DSH Web 打开 **Plugins** → **Add plugin**,选择 `ai4ai`。
|
|
51
|
+
2. **启用**该插件。
|
|
52
|
+
3. 按平时的方式重启 DSH 服务,然后刷新页面。
|
|
53
|
+
|
|
48
54
|
契约与细节见 [docs/contract.md](docs/contract.md)。MIT。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AdapterContext, CarrierCommand, StatusDetails } from '../external.js';
|
|
2
2
|
import { ExternalExecutorAdapter } from '../external.js';
|
|
3
|
-
import type { CapabilityDeclaration } from '../../contract/types.js';
|
|
3
|
+
import type { CapabilityDeclaration, Request } from '../../contract/types.js';
|
|
4
4
|
import type { HarnessId, Os } from '../../contract/states.js';
|
|
5
5
|
import type { ExecutorRecord } from '../../core/store.js';
|
|
6
6
|
import type { LogLine, ExecutorStatus } from '../executors.js';
|
|
@@ -15,6 +15,15 @@ export declare function claudePluginDir(home: string): string | undefined;
|
|
|
15
15
|
export declare class ClaudeAdapter extends ExternalExecutorAdapter {
|
|
16
16
|
readonly harness: HarnessId;
|
|
17
17
|
capabilities(os: Os): CapabilityDeclaration[];
|
|
18
|
+
/**
|
|
19
|
+
* Persist the model a resumed turn must keep. The carrier passes `--model`
|
|
20
|
+
* only when the request has one, so the effective value can come from the
|
|
21
|
+
* settings `env` block (which overrides the inherited process environment)
|
|
22
|
+
* or the process environment.
|
|
23
|
+
*/
|
|
24
|
+
protected persistedModel(request: Request, ctx: AdapterContext): Promise<string | undefined>;
|
|
25
|
+
/** `CLAUDE_CODE_EFFORT_LEVEL` overrides the settings `effortLevel`. */
|
|
26
|
+
protected persistedReasoningEffort(request: Request, ctx: AdapterContext): Promise<string | undefined>;
|
|
18
27
|
protected carrier(request: Parameters<ExternalExecutorAdapter['spawn']>[0], ctx: AdapterContext, _executorId: string, resumeSessionId?: string): Promise<CarrierCommand>;
|
|
19
28
|
protected statusDetails(_record: ExecutorRecord, status: ExecutorStatus, log: LogLine[], ctx: AdapterContext): Promise<StatusDetails>;
|
|
20
29
|
}
|
|
@@ -4,6 +4,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
4
4
|
import { ExternalExecutorAdapter, lastJson } from '../external.js';
|
|
5
5
|
import { resolveClaudeStatus } from './status.js';
|
|
6
6
|
import { verifiedText, verifiedTokens, verifiedWindow } from '../../core/ladder.js';
|
|
7
|
+
import { envValue, probeClaudeSettings } from '../../core/config-probe.js';
|
|
7
8
|
import { declaration } from '../declarations.js';
|
|
8
9
|
/**
|
|
9
10
|
* Claude Code adapter.
|
|
@@ -31,24 +32,48 @@ export function claudePluginDir(home) {
|
|
|
31
32
|
export class ClaudeAdapter extends ExternalExecutorAdapter {
|
|
32
33
|
harness = 'claude-code';
|
|
33
34
|
capabilities(os) {
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const linux = os === 'linux';
|
|
36
|
+
const mac = os === 'darwin';
|
|
37
|
+
// macOS proves both the handoff and the detached carrier in this release.
|
|
38
|
+
const reason = linux
|
|
39
|
+
? 'The mods plugin loads and the zero-summary restart replaces the context in place through the native compact hook while keeping the session id; a disabled-compaction session is reported unsupported. Detached carriers spawn, report status and survive the parent. Exercised on Linux.'
|
|
40
|
+
: mac
|
|
41
|
+
? 'The mods plugin loads and the zero-summary in-place restart completed on macOS with the session id preserved (handoff verified). The detached carrier was exercised on macOS with a real two-turn executor: spawn, status, message queued into the same session (both turn markers in the executor log), stop, and the error paths (unauthorized target, message to a completed executor) all completed.'
|
|
39
42
|
: 'The mods plugin and the detached carrier are implemented; native Windows is out of scope (WSL counts as Linux) and was not exercised.';
|
|
40
|
-
const
|
|
43
|
+
const carrier = linux || mac ? 'supported' : 'not-tested';
|
|
41
44
|
const common = {
|
|
42
|
-
handoff: { availability:
|
|
43
|
-
spawn: { availability:
|
|
44
|
-
status: { availability:
|
|
45
|
-
...(
|
|
45
|
+
handoff: { availability: linux || mac ? 'supported' : 'not-tested', modes: ['restart'] },
|
|
46
|
+
spawn: { availability: carrier, maxConcurrent: 4 },
|
|
47
|
+
status: { availability: carrier, model: carrier, reasoningEffort: 'unsupported', context: carrier, percentSource: 'derived' },
|
|
48
|
+
...(linux || mac ? { evidence: `matrix:claude-code/${os}/2026-11-21` } : {}),
|
|
46
49
|
};
|
|
47
50
|
return [
|
|
48
51
|
declaration({ harness: 'claude-code', os, interface: 'tui', reason, ...common }),
|
|
49
52
|
declaration({ harness: 'claude-code', os, interface: 'headless', reason, ...common }),
|
|
50
53
|
];
|
|
51
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Persist the model a resumed turn must keep. The carrier passes `--model`
|
|
57
|
+
* only when the request has one, so the effective value can come from the
|
|
58
|
+
* settings `env` block (which overrides the inherited process environment)
|
|
59
|
+
* or the process environment.
|
|
60
|
+
*/
|
|
61
|
+
async persistedModel(request, ctx) {
|
|
62
|
+
if (request.model)
|
|
63
|
+
return request.model;
|
|
64
|
+
const settings = await probeClaudeSettings(ctx.identity.workspace, undefined, ['ANTHROPIC_MODEL']).catch(() => null);
|
|
65
|
+
return settings?.env[0]?.value ?? envValue('ANTHROPIC_MODEL') ?? undefined;
|
|
66
|
+
}
|
|
67
|
+
/** `CLAUDE_CODE_EFFORT_LEVEL` overrides the settings `effortLevel`. */
|
|
68
|
+
async persistedReasoningEffort(request, ctx) {
|
|
69
|
+
if (request.reasoningEffort)
|
|
70
|
+
return request.reasoningEffort;
|
|
71
|
+
const env = envValue('CLAUDE_CODE_EFFORT_LEVEL');
|
|
72
|
+
if (env)
|
|
73
|
+
return env;
|
|
74
|
+
const settings = await probeClaudeSettings(ctx.identity.workspace, undefined, []).catch(() => null);
|
|
75
|
+
return settings?.effortLevel?.value ?? undefined;
|
|
76
|
+
}
|
|
52
77
|
async carrier(request, ctx, _executorId, resumeSessionId) {
|
|
53
78
|
// A detached executor has no one to answer permission prompts: run it in the
|
|
54
79
|
// harness's non-interactive bypass mode, consistent with the spawn contract.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Identity, Request, Result } from '../../contract/types.js';
|
|
2
|
+
import type { StoredProofMechanism } from '../../contract/states.js';
|
|
2
3
|
export type ClaudePhase = 'pending' | 'scheduled' | 'applied' | 'completed' | 'cancelled' | 'failed' | 'unknown';
|
|
3
4
|
export interface ClaudeRecord {
|
|
4
5
|
format: 2;
|
|
@@ -11,6 +12,12 @@ export interface ClaudeRecord {
|
|
|
11
12
|
reason: string;
|
|
12
13
|
/** Native context replacement strategy recorded for this handoff. */
|
|
13
14
|
mechanism?: 'restart' | 'compact';
|
|
15
|
+
/**
|
|
16
|
+
* Explicit proof mechanism. New records always set it. Records written
|
|
17
|
+
* before 0.0.5 lack it; their proof is derived from `mechanism` under the
|
|
18
|
+
* historical rules and is exempt from the same-session gate.
|
|
19
|
+
*/
|
|
20
|
+
proofMechanism?: StoredProofMechanism;
|
|
14
21
|
successor?: Identity;
|
|
15
22
|
}
|
|
16
23
|
export interface ClaudeCommand {
|
|
@@ -25,6 +32,7 @@ export interface ClaudeCommand {
|
|
|
25
32
|
/** Native successor identity after a restart (new session id) or compact generation. */
|
|
26
33
|
successor?: Identity;
|
|
27
34
|
mechanism?: 'restart' | 'compact';
|
|
35
|
+
proofMechanism?: StoredProofMechanism;
|
|
28
36
|
usage?: {
|
|
29
37
|
window?: number | null;
|
|
30
38
|
used?: number | null;
|
|
@@ -3,6 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { atomicJson, bytes, contained, digest, ownership, withScopeLock } from '../../install/scope.js';
|
|
4
4
|
import { result } from '../../contract/validate.js';
|
|
5
5
|
import { handoffOutcome } from '../../contract/states.js';
|
|
6
|
+
import { legacyProofMechanism } from '../../core/handoff.js';
|
|
6
7
|
const PHASES = ['pending', 'scheduled', 'applied', 'completed', 'cancelled', 'failed', 'unknown'];
|
|
7
8
|
const sessionKey = (identity) => `${identity.workspace}\0${identity.surface}\0${identity.session}`;
|
|
8
9
|
function response(record, operation = 'handoff') {
|
|
@@ -16,7 +17,9 @@ function response(record, operation = 'handoff') {
|
|
|
16
17
|
? {
|
|
17
18
|
proof: {
|
|
18
19
|
source: record.source, successor: record.successor,
|
|
19
|
-
|
|
20
|
+
// New records carry the explicit field; old records keep the
|
|
21
|
+
// mechanism they historically implied and stay legacy-exempt.
|
|
22
|
+
mechanism: record.proofMechanism ?? legacyProofMechanism(record.mechanism),
|
|
20
23
|
nativeEvidence: record.marker,
|
|
21
24
|
},
|
|
22
25
|
}
|