@avantf/dsh-mission 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/cordis.patch.yml +13 -0
- package/lib/client.js +225 -0
- package/lib/dsh-build.json +16 -0
- package/lib/envinit-bootstrap.js +334 -0
- package/lib/index.js +7021 -0
- package/lib/interface-version.json +4 -0
- package/lib/mission-core/capacity.d.ts +100 -0
- package/lib/mission-core/continuation.d.ts +106 -0
- package/lib/mission-core/dispatch.d.ts +165 -0
- package/lib/mission-core/engine.d.ts +331 -0
- package/lib/mission-core/index.d.ts +25 -0
- package/lib/mission-core/liveness.d.ts +99 -0
- package/lib/mission-core/prompt.d.ts +112 -0
- package/lib/mission-core/resources.d.ts +57 -0
- package/lib/mission-core/timing.d.ts +37 -0
- package/lib/mission-core/tree.d.ts +447 -0
- package/lib/mission-core/trouble.d.ts +40 -0
- package/lib/mission-core/types.d.ts +409 -0
- package/lib/mission-core/wellformed.d.ts +98 -0
- package/lib/types/claims.d.ts +3 -0
- package/lib/types/claims.d.ts.map +1 -0
- package/lib/types/client/MissionTreeView.d.ts +247 -0
- package/lib/types/client/MissionTreeView.d.ts.map +1 -0
- package/lib/types/client/api.d.ts +184 -0
- package/lib/types/client/api.d.ts.map +1 -0
- package/lib/types/client/contract.d.ts +209 -0
- package/lib/types/client/contract.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +48 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/seat.d.ts +26 -0
- package/lib/types/client/seat.d.ts.map +1 -0
- package/lib/types/client/styles.d.ts +6 -0
- package/lib/types/client/styles.d.ts.map +1 -0
- package/lib/types/coldResume.d.ts +123 -0
- package/lib/types/coldResume.d.ts.map +1 -0
- package/lib/types/domain.d.ts +93 -0
- package/lib/types/domain.d.ts.map +1 -0
- package/lib/types/envinit.d.ts +126 -0
- package/lib/types/envinit.d.ts.map +1 -0
- package/lib/types/executorSession.d.ts +129 -0
- package/lib/types/executorSession.d.ts.map +1 -0
- package/lib/types/faces.d.ts +30 -0
- package/lib/types/faces.d.ts.map +1 -0
- package/lib/types/host.d.ts +752 -0
- package/lib/types/host.d.ts.map +1 -0
- package/lib/types/index.d.ts +48 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/interface_gate.d.ts +51 -0
- package/lib/types/interface_gate.d.ts.map +1 -0
- package/lib/types/log.d.ts +18 -0
- package/lib/types/log.d.ts.map +1 -0
- package/lib/types/projectionCache.d.ts +22 -0
- package/lib/types/projectionCache.d.ts.map +1 -0
- package/lib/types/prompt.d.ts +106 -0
- package/lib/types/prompt.d.ts.map +1 -0
- package/lib/types/source.d.ts +22 -0
- package/lib/types/source.d.ts.map +1 -0
- package/lib/types/store.d.ts +20 -0
- package/lib/types/store.d.ts.map +1 -0
- package/lib/types/timeFormat.d.ts +56 -0
- package/lib/types/timeFormat.d.ts.map +1 -0
- package/lib/types/tools.d.ts +34 -0
- package/lib/types/tools.d.ts.map +1 -0
- package/lib/types/wellformed.d.ts +43 -0
- package/lib/types/wellformed.d.ts.map +1 -0
- package/lib/types/wire.d.ts +178 -0
- package/lib/types/wire.d.ts.map +1 -0
- package/lib/types/workerEvents.d.ts +36 -0
- package/lib/types/workerEvents.d.ts.map +1 -0
- package/lib/types/workerSessions.d.ts +256 -0
- package/lib/types/workerSessions.d.ts.map +1 -0
- package/package.json +145 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** The framework's module shape; `import type` only — the value is always loaded dynamically. */
|
|
2
|
+
type EnvinitModule = typeof import('@avantf/dsh-plugin-base');
|
|
3
|
+
/** The services this plugin calls: `required` is this plugin's refusal policy; `typert` and
|
|
4
|
+
* `commands` are optional because the engine degrades without them. */
|
|
5
|
+
interface ServiceContract {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly required: boolean;
|
|
8
|
+
readonly methods: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export interface CompatContext {
|
|
11
|
+
get(name: string): unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface CompatLogger {
|
|
14
|
+
info(message: string): void;
|
|
15
|
+
warn(message: string): void;
|
|
16
|
+
error(message: string): void;
|
|
17
|
+
}
|
|
18
|
+
/** What this plugin declares about itself, so the base's rules stay generic. */
|
|
19
|
+
interface CompatSpec {
|
|
20
|
+
readonly packageId: string;
|
|
21
|
+
readonly services: readonly ServiceContract[];
|
|
22
|
+
readonly declared: Readonly<Record<string, string | undefined>>;
|
|
23
|
+
readonly runtime?: Readonly<Record<string, string | undefined>>;
|
|
24
|
+
readonly probeTool?: () => unknown;
|
|
25
|
+
readonly probeTypert?: (packageId: string) => unknown;
|
|
26
|
+
readonly schemaNames?: readonly string[];
|
|
27
|
+
readonly events?: readonly string[];
|
|
28
|
+
readonly needsInterval?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface CompatLine {
|
|
31
|
+
readonly level: 'info' | 'warn' | 'error';
|
|
32
|
+
readonly message: string;
|
|
33
|
+
}
|
|
34
|
+
export interface CompatVerdict {
|
|
35
|
+
readonly load: boolean;
|
|
36
|
+
readonly skipped: boolean;
|
|
37
|
+
readonly status: string;
|
|
38
|
+
readonly problems: readonly string[];
|
|
39
|
+
readonly warnings: readonly string[];
|
|
40
|
+
readonly notes: readonly string[];
|
|
41
|
+
readonly lines: readonly CompatLine[];
|
|
42
|
+
readonly reason: string;
|
|
43
|
+
}
|
|
44
|
+
export interface CompatModule {
|
|
45
|
+
readonly COMPAT_PREFIX: string;
|
|
46
|
+
readonly BUILD_VERSIONS_FILE: string;
|
|
47
|
+
provision(ctx: CompatContext, log: CompatLogger, spec: CompatSpec): CompatVerdict;
|
|
48
|
+
compatReport(verdict: CompatVerdict, words: {
|
|
49
|
+
readonly heading: string;
|
|
50
|
+
readonly fix: string;
|
|
51
|
+
readonly warningsLabel: string;
|
|
52
|
+
readonly warnings: readonly string[];
|
|
53
|
+
/** Only present when the loaded base is new enough to accept it; see `compatReport`. */
|
|
54
|
+
readonly logPointer?: (prefix: string) => string;
|
|
55
|
+
}): string;
|
|
56
|
+
registerMegaphone(input: {
|
|
57
|
+
readonly ctx: CompatContext;
|
|
58
|
+
readonly log: CompatLogger;
|
|
59
|
+
readonly command: {
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly description: string;
|
|
62
|
+
};
|
|
63
|
+
readonly text: string;
|
|
64
|
+
}): void;
|
|
65
|
+
schemaNamesFrom(contribution: unknown): readonly string[];
|
|
66
|
+
verifyRegisteredFaces(input: {
|
|
67
|
+
readonly ctx: CompatContext;
|
|
68
|
+
readonly packageId: string;
|
|
69
|
+
readonly schemaNames?: readonly string[];
|
|
70
|
+
readonly toolNames: readonly string[];
|
|
71
|
+
readonly log: CompatLogger;
|
|
72
|
+
}): {
|
|
73
|
+
readonly missing: readonly string[];
|
|
74
|
+
};
|
|
75
|
+
readDeclaredVersions(manifestUrl: string | URL, packages: readonly string[]): Record<string, string | undefined>;
|
|
76
|
+
readBuildVersions(buildUrl: string | URL, packages: readonly string[], fallback?: Readonly<Record<string, string | undefined>>): Record<string, string | undefined>;
|
|
77
|
+
readRuntimeVersions(packages: readonly string[], base?: string | URL): Record<string, string | undefined>;
|
|
78
|
+
toolProbeDeclaration(defineTool: (options: unknown) => unknown): () => unknown;
|
|
79
|
+
}
|
|
80
|
+
/** The loaded base, with everything derived from it for THIS plugin. */
|
|
81
|
+
export interface CompatRuntime {
|
|
82
|
+
readonly module: CompatModule;
|
|
83
|
+
/**
|
|
84
|
+
* The loaded base module itself — the runtime source of the shared KIT (prompt files, logger,
|
|
85
|
+
* family paths). `undefined` only in the test seam that injects a partial module; the real load
|
|
86
|
+
* always has it. A capability missing here is a DEGRADATION, never a refusal.
|
|
87
|
+
*/
|
|
88
|
+
readonly kit: EnvinitModule | undefined;
|
|
89
|
+
readonly prefix: string;
|
|
90
|
+
readonly spec: CompatSpec;
|
|
91
|
+
readonly schemaNames: readonly string[];
|
|
92
|
+
}
|
|
93
|
+
interface CompatLoadOptions {
|
|
94
|
+
readonly log?: CompatLogger;
|
|
95
|
+
/** Test seam: the loaded base module, instead of bootstrapping it from this plugin's install. */
|
|
96
|
+
readonly framework?: EnvinitModule;
|
|
97
|
+
/**
|
|
98
|
+
* Test seam: a structural stand-in for the gate half of the base, so the refusal / megaphone /
|
|
99
|
+
* post-registration shapes can be driven without a real host. The kit still comes from the module
|
|
100
|
+
* {@link CompatLoadOptions.framework} names.
|
|
101
|
+
*/
|
|
102
|
+
readonly compatModule?: CompatModule;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Ensure the framework, then the base, then this plugin's gate runtime. Never throws: it returns
|
|
106
|
+
* `undefined` when the gate cannot run, and the caller then warns and mounts because a missing gate
|
|
107
|
+
* is "cannot tell". Cached, so the spec is built once per process.
|
|
108
|
+
*/
|
|
109
|
+
export declare function loadCompat(options?: CompatLoadOptions): Promise<CompatRuntime | undefined>;
|
|
110
|
+
/** Run the gate FIRST in `apply()`: on a refusal nothing is registered yet, so "do not load" costs nothing to unwind; never throws. */
|
|
111
|
+
export declare function provision(ctx: CompatContext, log: CompatLogger, compat: CompatRuntime): CompatVerdict;
|
|
112
|
+
/** Keep one `/mission` command reporting the refusal; guarded, because on the REFUSAL path the report
|
|
113
|
+
* is the user's only channel and a shape mismatch must not reject `apply` and take it down. */
|
|
114
|
+
export declare function registerCompatMegaphone(ctx: CompatContext, verdict: CompatVerdict, log: CompatLogger, compat: CompatRuntime): void;
|
|
115
|
+
/** Second phase: every real registration must be visible afterwards; warn-only, since the plugin is
|
|
116
|
+
* mounted by now and no clean "do not load" is left. */
|
|
117
|
+
export declare function verifyRegisteredFaces(input: {
|
|
118
|
+
readonly ctx: CompatContext;
|
|
119
|
+
readonly toolNames: readonly string[];
|
|
120
|
+
readonly log: CompatLogger;
|
|
121
|
+
readonly compat: CompatRuntime;
|
|
122
|
+
}): {
|
|
123
|
+
readonly missing: readonly string[];
|
|
124
|
+
};
|
|
125
|
+
export {};
|
|
126
|
+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C,GAAG,EAAE,YAAY,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAC/B,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAa1C"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finding the session that executed ONE historical mission, lazily.
|
|
3
|
+
*
|
|
4
|
+
* W17 made a node id clickable only when the record already carried `executorSessionId`. Nodes
|
|
5
|
+
* dispatched before that field existed have none, so their id was plain text and the session that
|
|
6
|
+
* ran them was unreachable from the panel. The fix cannot be "backfill at mount": resolving a
|
|
7
|
+
* historical executor means LISTING sessions and READING session logs, and doing that while the
|
|
8
|
+
* panel mounts would put the cost of every unlinkable node on every page load.
|
|
9
|
+
*
|
|
10
|
+
* So this module is the click-time half: it is called only from the Remote method that a click
|
|
11
|
+
* invokes, and it answers with a reason rather than an exception, because a miss is an ordinary
|
|
12
|
+
* outcome (the session may have been cleaned up) that the panel has to be able to explain.
|
|
13
|
+
*
|
|
14
|
+
* It is deliberately separated from `host.ts`: the host owns the tree and the write-back, this owns
|
|
15
|
+
* "which stored session is the one that ran node X", and a test can pin the filtering rules and the
|
|
16
|
+
* read budget with no tree and no engine.
|
|
17
|
+
* @module @avantf/dsh-mission/executorSession
|
|
18
|
+
*/
|
|
19
|
+
/** One stored session, as `sessionQuery.listSessions()` reports it (the fields the filter reads). */
|
|
20
|
+
export interface ListedSession {
|
|
21
|
+
readonly header: {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly createdAt?: number;
|
|
24
|
+
readonly parentSession?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The two `SessionEventResultFilter` members this resolver sends, transcribed from the REAL contract
|
|
29
|
+
* (`@deepseek-ai/dsh-session-query`): a filter array is ANDed, and every clause is an OBJECT
|
|
30
|
+
* discriminated by `kind`. It is NOT a tuple array — W20 shipped `[['time', from, to], ['text', …]]`,
|
|
31
|
+
* which the real `materializeSessionEventResultFilters` rejects with `unknown filter kind (missing)`
|
|
32
|
+
* before it reads anything. The local union stays structural (this module imports no optional
|
|
33
|
+
* service), but it must mirror that shape, and only the two members actually used are declared.
|
|
34
|
+
*/
|
|
35
|
+
type SessionEventFilter = {
|
|
36
|
+
readonly kind: 'time';
|
|
37
|
+
readonly from?: number;
|
|
38
|
+
readonly to?: number;
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: 'text';
|
|
41
|
+
readonly text: string;
|
|
42
|
+
};
|
|
43
|
+
/** The slice of `sessionQuery` this resolver uses. Structural, like every optional service here. */
|
|
44
|
+
export interface SessionQueryLike {
|
|
45
|
+
listSessions(): Promise<readonly ListedSession[]>;
|
|
46
|
+
/** Events of one session, AND-filtered by the real `SessionEventResultFilter` object union. */
|
|
47
|
+
filterEvents(sessionId: string, filters: readonly SessionEventFilter[]): Promise<readonly {
|
|
48
|
+
readonly text: string;
|
|
49
|
+
}[]>;
|
|
50
|
+
}
|
|
51
|
+
interface ResolveExecutorSessionOptions {
|
|
52
|
+
readonly node: {
|
|
53
|
+
readonly createdAt?: number;
|
|
54
|
+
readonly activityAt?: number;
|
|
55
|
+
readonly updatedAt?: number;
|
|
56
|
+
/**
|
|
57
|
+
* How many times this node has been dispatched. `0` is the DURABLE proof that no session ever
|
|
58
|
+
* ran it (and what the panel's "从未派发" sentence is about); `undefined` means the record cannot
|
|
59
|
+
* say, and the lookup proceeds rather than asserting something it does not know.
|
|
60
|
+
*/
|
|
61
|
+
readonly attempts?: number;
|
|
62
|
+
};
|
|
63
|
+
/** The owner session every worker hangs under — the panel's own session. */
|
|
64
|
+
readonly ownerSessionId: string;
|
|
65
|
+
/** The optional `sessionQuery` service; omitted means the host cannot look anything up. */
|
|
66
|
+
readonly query: SessionQueryLike | undefined;
|
|
67
|
+
/** Wall clock, injected so a test fixes the window. */
|
|
68
|
+
readonly now: number;
|
|
69
|
+
/**
|
|
70
|
+
* Where a failed per-candidate log read goes. The failure must not VANISH: a filter whose SHAPE
|
|
71
|
+
* the service rejects fails on every candidate and, from the outside, looks exactly like "the
|
|
72
|
+
* session is gone" — which is how W20's total outage stayed green. At most one message per
|
|
73
|
+
* lookup; absent means no sink (tests that do not care).
|
|
74
|
+
*/
|
|
75
|
+
readonly warn?: (message: string) => void;
|
|
76
|
+
}
|
|
77
|
+
/** Why no session could be named. The panel turns each into its own sentence. */
|
|
78
|
+
type ExecutorSessionResolution = {
|
|
79
|
+
readonly status: 'resolved';
|
|
80
|
+
readonly sessionId: string;
|
|
81
|
+
readonly candidatesRead: number;
|
|
82
|
+
} | {
|
|
83
|
+
readonly status: 'never-dispatched';
|
|
84
|
+
} | {
|
|
85
|
+
readonly status: 'not-found';
|
|
86
|
+
} | {
|
|
87
|
+
readonly status: 'unsupported';
|
|
88
|
+
readonly error: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Worst-case number of session LOGS one click may read.
|
|
92
|
+
*
|
|
93
|
+
* The three candidate filters (parent, id shape, time window) are metadata and free; this bounds the
|
|
94
|
+
* part that opens stored logs. A miss over more than this many candidates inside one node's own time
|
|
95
|
+
* window is not a lookup problem — the owner simply ran many sessions while this node was alive —
|
|
96
|
+
* and the bound is what keeps a click from turning into a scan of the whole corpus.
|
|
97
|
+
*/
|
|
98
|
+
export declare const RESOLVE_READ_BUDGET = 8;
|
|
99
|
+
/**
|
|
100
|
+
* Slack around a node's own time window, in ms. Both ends exist for the same reason: the node
|
|
101
|
+
* record and the session header are written by different code, so clocks a second or two apart
|
|
102
|
+
* would otherwise hide the very session being looked for.
|
|
103
|
+
*
|
|
104
|
+
* Both margins are small BECAUSE of what they bound. The START is the node's creation, and the
|
|
105
|
+
* session that ran it is created at (or within seconds of) the dispatch that stamped the record.
|
|
106
|
+
* The END is the node's last movement, and the last attempt was dispatched BEFORE it — a wide
|
|
107
|
+
* trailing margin would only re-admit the owner's later, unrelated work, which is exactly what the
|
|
108
|
+
* time clause exists to keep out of the read budget.
|
|
109
|
+
*/
|
|
110
|
+
export declare const WINDOW_BEFORE_MS = 120000;
|
|
111
|
+
export declare const WINDOW_AFTER_MS = 120000;
|
|
112
|
+
/**
|
|
113
|
+
* Resolve one node's executor session from stored sessions, or say why not.
|
|
114
|
+
*
|
|
115
|
+
* Order of the answer: a node whose `attempts` is 0 is `never-dispatched` (nothing ever ran it, so
|
|
116
|
+
* there is nothing to look for — and the panel must be able to say that instead of "it may have
|
|
117
|
+
* been cleaned up"); a host without `sessionQuery` is `unsupported` (a real deployment can be
|
|
118
|
+
* headless, and the panel must say so instead of crashing); otherwise the filtered candidates are
|
|
119
|
+
* read newest-first until one matches or the budget is spent.
|
|
120
|
+
*
|
|
121
|
+
* A spent budget with no match splits in two, and the split is the point: if at least ONE candidate
|
|
122
|
+
* was read successfully, the honest reading is `not-found` ("it was dispatched once, and the session
|
|
123
|
+
* is gone now"); if EVERY candidate we read failed, nothing was actually searched and the answer is
|
|
124
|
+
* `unsupported` carrying the first reason — a broken filter shape or a dead backend must never be
|
|
125
|
+
* dressed up as "the session was cleaned up" (W20).
|
|
126
|
+
*/
|
|
127
|
+
export declare function resolveExecutorSession(nodeId: string, options: ResolveExecutorSessionOptions): Promise<ExecutorSessionResolution>;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=executorSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorSession.d.ts","sourceRoot":"","sources":["../../src/executorSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qGAAqG;AACrG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAChC,CAAA;CACF;AAED;;;;;;;GAOG;AACH,KAAK,kBAAkB,G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AE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAC5F;IAAE,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,GACvC;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,SAAU,CAAA;AACvC,eAAO,MAAM,eAAe,SAAU,CAAA;AAmItC;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,yBAAyB,CAAC,CAoDpC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two tool faces, split so neither caller carries the other's tools: an executor's
|
|
3
|
+
* rides `toolFilter.deny` on dispatch, the owner's is applied at `agent/created` and in the
|
|
4
|
+
* assembly waterfall. Hiding is usability only — the refusals stay the boundary.
|
|
5
|
+
* @module @avantf/dsh-mission/faces
|
|
6
|
+
*/
|
|
7
|
+
export declare const OWNER_TOOL_DENY: readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* Everything an executor must not hold, grouped by WHY it is dangerous here:
|
|
10
|
+
*
|
|
11
|
+
* - `subagent` / `subagent_fork` start mission the TREE cannot see (no node, no result, no convergence),
|
|
12
|
+
* and `send_message` delivers into sessions outside this mission — the owner's included, which is how an
|
|
13
|
+
* executor would report around the tree instead of through `submit_mission`.
|
|
14
|
+
* - `create_goal` / `get_goal` / `update_goal` are the OWNER's: an executor that can read or rewrite
|
|
15
|
+
* the goal it is judged against is answering to a different objective than the one the tree
|
|
16
|
+
* dispatched, and `dsh-tool-goal`'s static section rides the owner's preset into the executor
|
|
17
|
+
* (the Known limit at the end of `prompt.ts` records that residue).
|
|
18
|
+
* - the last six are the owner's mission-tree face; an executor touches the tree only through
|
|
19
|
+
* `note_mission` / `decompose_mission` / `submit_mission`.
|
|
20
|
+
*
|
|
21
|
+
* Only `subagent` / `subagent_fork` actually SPAWN a session — the rest are refusals of access, not
|
|
22
|
+
* of spawning, and the comment here used to claim otherwise for all six.
|
|
23
|
+
*
|
|
24
|
+
* `note_mission` is deliberately absent — `decompose_mission` needs it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const WORKER_TOOL_DENY: readonly string[];
|
|
27
|
+
export declare function visibleTo<T extends {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
}>(tools: readonly T[], hidden: readonly string[]): T[];
|
|
30
|
+
//# sourceMappingURL=faces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/faces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAI5C,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAa7C,CAAA;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAC3D,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,CAAC,EAAE,CAGL"}
|