@theokit/sdk 4.63.4-next.0 → 4.63.5
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/CHANGELOG.md +87 -14
- package/dist/{agent-PVINJTUR.cjs → agent-HM326RNG.cjs} +7 -7
- package/dist/{agent-PVINJTUR.cjs.map → agent-HM326RNG.cjs.map} +1 -1
- package/dist/{agent-3JK7VXNN.js → agent-Y25FRHPL.js} +6 -6
- package/dist/{agent-3JK7VXNN.js.map → agent-Y25FRHPL.js.map} +1 -1
- package/dist/agent.d.ts +20 -2
- package/dist/chunk-247ZTLNU.js +73 -0
- package/dist/chunk-247ZTLNU.js.map +1 -0
- package/dist/{chunk-GPKAF7SG.js → chunk-2OQHBPPV.js} +3 -3
- package/dist/{chunk-GPKAF7SG.js.map → chunk-2OQHBPPV.js.map} +1 -1
- package/dist/{chunk-CQBXOJ6U.cjs → chunk-43ZQRWAP.cjs} +5 -5
- package/dist/{chunk-CQBXOJ6U.cjs.map → chunk-43ZQRWAP.cjs.map} +1 -1
- package/dist/chunk-AKJP2STZ.cjs +81 -0
- package/dist/chunk-AKJP2STZ.cjs.map +1 -0
- package/dist/{chunk-JJ3OVRUM.cjs → chunk-BLTTW3KY.cjs} +157 -37
- package/dist/chunk-BLTTW3KY.cjs.map +1 -0
- package/dist/{chunk-ZWRG4NWT.cjs → chunk-EGCKRW36.cjs} +4 -4
- package/dist/{chunk-ZWRG4NWT.cjs.map → chunk-EGCKRW36.cjs.map} +1 -1
- package/dist/{chunk-25BD2R5G.js → chunk-GP7NHU3R.js} +134 -14
- package/dist/chunk-GP7NHU3R.js.map +1 -0
- package/dist/{chunk-LXI4XZEC.js → chunk-LKBEROHN.js} +3 -3
- package/dist/{chunk-LXI4XZEC.js.map → chunk-LKBEROHN.js.map} +1 -1
- package/dist/{chunk-K5OJUYSZ.js → chunk-NDGGJQTZ.js} +13 -4
- package/dist/chunk-NDGGJQTZ.js.map +1 -0
- package/dist/{chunk-ZCIRZE37.cjs → chunk-VCLBZAZU.cjs} +14 -5
- package/dist/chunk-VCLBZAZU.cjs.map +1 -0
- package/dist/{context-AGQ3DIZU.cjs → context-WFLTTMK3.cjs} +7 -7
- package/dist/{context-AGQ3DIZU.cjs.map → context-WFLTTMK3.cjs.map} +1 -1
- package/dist/context-WI2DFG7V.js +7 -0
- package/dist/{context-GQRFBCLP.js.map → context-WI2DFG7V.js.map} +1 -1
- package/dist/cron.cjs +6 -6
- package/dist/cron.js +5 -5
- package/dist/eval.cjs +5 -5
- package/dist/eval.js +4 -4
- package/dist/index.cjs +20 -20
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +7 -7
- package/dist/internal/agent-loop/replay-messages.d.ts +41 -0
- package/dist/internal/local-agent/local-option-keys.d.ts +2 -0
- package/dist/internal/persistence/index.cjs +4 -4
- package/dist/internal/persistence/index.js +1 -1
- package/dist/internal/runtime/compat/foreign-config-sources.d.ts +92 -0
- package/dist/internal/runtime/hooks/hooks-executor.d.ts +9 -0
- package/dist/internal/runtime/hooks/hooks-source.d.ts +9 -0
- package/dist/subagents-loader-UCNO7FUH.cjs +17 -0
- package/dist/{subagents-loader-YEUFFPAL.cjs.map → subagents-loader-UCNO7FUH.cjs.map} +1 -1
- package/dist/subagents-loader-XP5ERVDZ.js +8 -0
- package/dist/{subagents-loader-CRT5LLL3.js.map → subagents-loader-XP5ERVDZ.js.map} +1 -1
- package/dist/subagents-loader.cjs +3 -3
- package/dist/subagents-loader.js +2 -2
- package/docs/error-codes.md +5 -5
- package/package.json +1 -1
- package/dist/chunk-25BD2R5G.js.map +0 -1
- package/dist/chunk-AQO3NSRG.cjs +0 -41
- package/dist/chunk-AQO3NSRG.cjs.map +0 -1
- package/dist/chunk-JJ3OVRUM.cjs.map +0 -1
- package/dist/chunk-K5OJUYSZ.js.map +0 -1
- package/dist/chunk-UFLD2HEV.js +0 -35
- package/dist/chunk-UFLD2HEV.js.map +0 -1
- package/dist/chunk-ZCIRZE37.cjs.map +0 -1
- package/dist/context-GQRFBCLP.js +0 -7
- package/dist/subagents-loader-CRT5LLL3.js +0 -8
- package/dist/subagents-loader-YEUFFPAL.cjs +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -858,11 +858,29 @@ declare class Agent {
|
|
|
858
858
|
*/
|
|
859
859
|
static describe(agentId: string): Promise<AgentDescription>;
|
|
860
860
|
/**
|
|
861
|
-
* Permanently delete a
|
|
861
|
+
* Permanently delete a registered agent — local or cloud.
|
|
862
|
+
*
|
|
863
|
+
* Backport of #612 (fixed on the 5.x line in `5.3.1`). This HYDRATES before removing, and until it
|
|
864
|
+
* did the method was a no-op against the persisted registry whenever the agent was not already in
|
|
865
|
+
* this process's memory. Which is every agent in a freshly started process: `removeRegisteredAgent`
|
|
866
|
+
* only schedules a save when the entry was in the Map, so `agents.delete()` returned `false`,
|
|
867
|
+
* nothing was scheduled, and `flushRegistrySaves()` flushed an empty queue. The entry survived and
|
|
868
|
+
* this returned normally, so a caller had no way to notice.
|
|
869
|
+
*
|
|
870
|
+
* Every neighbouring mutator already did this — `rename` and `archive` reach
|
|
871
|
+
* `getRegisteredAgentOrThrow`, which hydrates on a miss. `delete` was the only one that did not.
|
|
872
|
+
*
|
|
873
|
+
* `options.cwd` is read rather than defaulted away: it is declared on `AgentOperationOptions`, and
|
|
874
|
+
* hydrating `process.cwd()` unconditionally is an option that compiles and does nothing, on the one
|
|
875
|
+
* path that is supposed to remove data.
|
|
876
|
+
*
|
|
877
|
+
* Deleting an unknown id still resolves rather than throwing, deliberately — matching 5.x. It is a
|
|
878
|
+
* breaking change for callers that delete idempotently, and an entry and its transcript can
|
|
879
|
+
* legitimately outlive one another in both directions.
|
|
862
880
|
*
|
|
863
881
|
* @public
|
|
864
882
|
*/
|
|
865
|
-
static delete(agentId: string,
|
|
883
|
+
static delete(agentId: string, options?: AgentOperationOptions): Promise<void>;
|
|
866
884
|
}
|
|
867
885
|
|
|
868
886
|
/**
|
package/dist/index.js
CHANGED
|
@@ -8,15 +8,15 @@ import { Workflow, agentStep } from './chunk-OSEG74VJ.js';
|
|
|
8
8
|
export { Workflow, agentStep, fn } from './chunk-OSEG74VJ.js';
|
|
9
9
|
import './chunk-BZRFXJHA.js';
|
|
10
10
|
import './chunk-HY66GLM6.js';
|
|
11
|
-
export { Cron } from './chunk-
|
|
12
|
-
import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-
|
|
13
|
-
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-
|
|
11
|
+
export { Cron } from './chunk-2OQHBPPV.js';
|
|
12
|
+
import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-GP7NHU3R.js';
|
|
13
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-GP7NHU3R.js';
|
|
14
14
|
import { configure, submit, list, get, cancel, subscribe } from './chunk-A46SWMIF.js';
|
|
15
15
|
export { emitRunEvent } from './chunk-A46SWMIF.js';
|
|
16
16
|
import './chunk-4FFBAUFS.js';
|
|
17
17
|
import './chunk-K2BQQ445.js';
|
|
18
18
|
import './chunk-L3MTL4NA.js';
|
|
19
|
-
import './chunk-
|
|
19
|
+
import './chunk-NDGGJQTZ.js';
|
|
20
20
|
import './chunk-2SFBB54R.js';
|
|
21
21
|
import './chunk-UBDMVMBZ.js';
|
|
22
22
|
import './chunk-H73MEMQB.js';
|
|
@@ -54,8 +54,8 @@ import { withCwdMutex } from './chunk-Q5EWJPRY.js';
|
|
|
54
54
|
export { withCwdMutex } from './chunk-Q5EWJPRY.js';
|
|
55
55
|
export { TASK_RESERVED_PREFIXES, isValidTaskId } from './chunk-KQRW2GPZ.js';
|
|
56
56
|
import { replaceFileAtomic } from './chunk-2GUYQR5P.js';
|
|
57
|
-
import './chunk-
|
|
58
|
-
import './chunk-
|
|
57
|
+
import './chunk-LKBEROHN.js';
|
|
58
|
+
import './chunk-247ZTLNU.js';
|
|
59
59
|
import './chunk-LXQ6HKPS.js';
|
|
60
60
|
import './chunk-A4JVILQU.js';
|
|
61
61
|
import { parseModelId } from './chunk-R7WIIPUR.js';
|
|
@@ -1705,7 +1705,7 @@ function isBuiltAgent(m) {
|
|
|
1705
1705
|
return typeof m.send === "function";
|
|
1706
1706
|
}
|
|
1707
1707
|
async function materialize(def, index) {
|
|
1708
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1708
|
+
const { Agent: Agent2 } = await import('./agent-Y25FRHPL.js');
|
|
1709
1709
|
return Agent2.create({
|
|
1710
1710
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1711
1711
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SessionMessage } from "../../types/session-message.js";
|
|
2
|
+
import type { LlmMessage } from "../llm/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Rebuild the model's history from a session's stored turns.
|
|
5
|
+
*
|
|
6
|
+
* ## Why this exists
|
|
7
|
+
*
|
|
8
|
+
* The replay used to be one line — `content: [{ type: "text", text: msg.text }]` — and `text` is the
|
|
9
|
+
* FLAT projection, in which a tool call folds to `[tool call] NAME` and a result to
|
|
10
|
+
* `[tool result] <body>`. So a resumed session showed the model its own prior turn as prose
|
|
11
|
+
* containing a marker, and the model did the reasonable thing with a pattern it is shown: it wrote
|
|
12
|
+
* the marker instead of calling the tool (usetheokit/theokit#631). A consumer saw
|
|
13
|
+
* `"…report its output.[tool call] run_shell"` in the assistant's reply, with no tool call behind it.
|
|
14
|
+
*
|
|
15
|
+
* The structured projection was already there. `narrowToSessionMessage` returns BOTH `text` and
|
|
16
|
+
* `parts`, and `parts` carries the call id, the tool name and the arguments — everything the flat
|
|
17
|
+
* form destroys. Nothing read it: `msg.parts` appeared nowhere in the shipped bundle.
|
|
18
|
+
*
|
|
19
|
+
* ## The shape it produces
|
|
20
|
+
*
|
|
21
|
+
* `SessionMessagePart` and `LlmContentPart` agree field for field on all three cases, which is what
|
|
22
|
+
* makes this a mapping rather than a translation. What does NOT carry over is the grouping: a
|
|
23
|
+
* `tool_result` may not travel in an assistant message. The live loop already settles that —
|
|
24
|
+
* `loop.ts` pushes results as `{ role: "user", content: toolResults }` — so a replayed turn is split
|
|
25
|
+
* the same way rather than inventing a second convention for the same provider wire.
|
|
26
|
+
*
|
|
27
|
+
* ## When it falls back
|
|
28
|
+
*
|
|
29
|
+
* `parts` is optional and its absence means "this projection carries no structure", never "this turn
|
|
30
|
+
* had none" — a `SessionMessage` built in memory during a live turn has only `text`. So a message
|
|
31
|
+
* without parts replays exactly as before. That is also what keeps this safe for a session stored by
|
|
32
|
+
* an older SDK: those rows have no `parts`, and they keep the behaviour they were written under.
|
|
33
|
+
*
|
|
34
|
+
* ## An empty text part is dropped
|
|
35
|
+
*
|
|
36
|
+
* A `{ type: "text", text: "" }` survives the projection — a turn that was only a tool call has one,
|
|
37
|
+
* because `partToText` folds the call and leaves the text empty. Several provider wires reject an
|
|
38
|
+
* empty text block outright, and none of them need it, so it does not travel. Dropping it is also
|
|
39
|
+
* what makes the `own.length > 0` guard below meaningful rather than incidental.
|
|
40
|
+
*/
|
|
41
|
+
export declare function replayMessages(prior: readonly SessionMessage[]): LlmMessage[];
|
|
@@ -7,7 +7,7 @@ var chunk5VB22SYX_cjs = require('../../chunk-5VB22SYX.cjs');
|
|
|
7
7
|
var chunkUU36SHFY_cjs = require('../../chunk-UU36SHFY.cjs');
|
|
8
8
|
var chunkZF2LDKQQ_cjs = require('../../chunk-ZF2LDKQQ.cjs');
|
|
9
9
|
var chunkUALX2J2Q_cjs = require('../../chunk-UALX2J2Q.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkAKJP2STZ_cjs = require('../../chunk-AKJP2STZ.cjs');
|
|
11
11
|
require('../../chunk-4ZHTIJNE.cjs');
|
|
12
12
|
require('../../chunk-XL7Q7HB2.cjs');
|
|
13
13
|
require('../../chunk-EG4QM7ZJ.cjs');
|
|
@@ -112,15 +112,15 @@ Object.defineProperty(exports, "replaceFileAtomic", {
|
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "displayTheokitHome", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkAKJP2STZ_cjs.displayTheokitHome; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "getProfilesRoot", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkAKJP2STZ_cjs.getProfilesRoot; }
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "getTheokitHome", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkAKJP2STZ_cjs.getTheokitHome; }
|
|
124
124
|
});
|
|
125
125
|
exports.casUpdate = casUpdate;
|
|
126
126
|
exports.createExclusive = createExclusive;
|
|
@@ -5,7 +5,7 @@ export { applyWalWithFallback, isCorruptionError, openSqliteResilient } from '..
|
|
|
5
5
|
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from '../../chunk-3O42QOMJ.js';
|
|
6
6
|
export { withCwdMutex } from '../../chunk-Q5EWJPRY.js';
|
|
7
7
|
export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-2GUYQR5P.js';
|
|
8
|
-
export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-
|
|
8
|
+
export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-247ZTLNU.js';
|
|
9
9
|
import '../../chunk-ZZMZWBR6.js';
|
|
10
10
|
import '../../chunk-D4CUGAKZ.js';
|
|
11
11
|
import '../../chunk-XEQ3TM66.js';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The foreign configuration dialects this SDK can read, and what each one PRESUMES.
|
|
3
|
+
*
|
|
4
|
+
* ## Why a registry and not a list of directory names
|
|
5
|
+
*
|
|
6
|
+
* `projectConfigRoots` returned `[".theokit", ".claude"]` — two paths — and that shape is what
|
|
7
|
+
* usetheokit/theokit-sdk#522 fell through. A path says WHERE a file lives. It does not say how the
|
|
8
|
+
* file is parsed, and it does not say what runtime the commands inside it were written against.
|
|
9
|
+
*
|
|
10
|
+
* Claude Code defines `$CLAUDE_PROJECT_DIR` for the hook commands in its `settings.json`, and its
|
|
11
|
+
* documentation tells authors to reach project files through it — an absolute path would break for
|
|
12
|
+
* every other person on the team, so the shape that failed here is the shape upstream recommends.
|
|
13
|
+
* This SDK read the file and ran the command without the variable. `sh` expands an unset variable to
|
|
14
|
+
* the empty string, so
|
|
15
|
+
*
|
|
16
|
+
* bash "$CLAUDE_PROJECT_DIR/.claude/hooks/guard.sh" became bash "/.claude/hooks/guard.sh"
|
|
17
|
+
*
|
|
18
|
+
* which does not exist, which a hook runner correctly reads as a refusal. Every turn denied, in any
|
|
19
|
+
* repository that also had Claude Code set up, with a message naming a file that was present and
|
|
20
|
+
* executable all along.
|
|
21
|
+
*
|
|
22
|
+
* Importing a format means accepting the contract that format presumes. An adapter is where that
|
|
23
|
+
* contract is written down, so the next dialect (`.codex/` is the obvious one) declares its own
|
|
24
|
+
* instead of inheriting a hole.
|
|
25
|
+
*
|
|
26
|
+
* ## What an adapter deliberately does NOT do
|
|
27
|
+
*
|
|
28
|
+
* It does not make the foreign source trusted, and it does not make its hooks permissive: a script
|
|
29
|
+
* that exits non-zero is still a refusal. It supplies the variables the format's authors were
|
|
30
|
+
* entitled to assume, and nothing else — `env` here is merged over the scrubbed inherit policy by
|
|
31
|
+
* `spawnAndCollect`, so it adds names rather than widening what a child can see.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
/** The Claude Code CLI's project configuration directory. */
|
|
36
|
+
export declare const CLAUDE_DIR_NAME = ".claude";
|
|
37
|
+
/** A configuration dialect this SDK understands. `theokit` is native; the rest are foreign. */
|
|
38
|
+
export interface ConfigSourceAdapter {
|
|
39
|
+
/** Stable identifier, and what a consumer names to opt in. */
|
|
40
|
+
readonly kind: string;
|
|
41
|
+
/** The project-relative directory the dialect keeps its configuration in. */
|
|
42
|
+
readonly dirName: string;
|
|
43
|
+
/**
|
|
44
|
+
* Variables the dialect's own runtime defines for commands it executes.
|
|
45
|
+
*
|
|
46
|
+
* Empty for the native source: a `.theokit/` hook is written against THIS runtime and inherits it
|
|
47
|
+
* already. Non-empty is what makes a foreign command runnable rather than silently broken.
|
|
48
|
+
*/
|
|
49
|
+
runtimeEnv(cwd: string): Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
/** The native source. Always read, never opted into, always first for precedence. */
|
|
52
|
+
export declare const NATIVE_SOURCE: ConfigSourceAdapter;
|
|
53
|
+
/**
|
|
54
|
+
* Claude Code.
|
|
55
|
+
*
|
|
56
|
+
* `CLAUDE_PROJECT_DIR` is the documented way for a hook command in `settings.json` to reach a file
|
|
57
|
+
* in the project. Only that one variable is supplied: `$CLAUDE_PLUGIN_ROOT` and the rest of that
|
|
58
|
+
* runtime's surface are NOT defined here, because supplying a name whose value this SDK would have
|
|
59
|
+
* to invent is worse than leaving it unset — an invented root sends a script somewhere real and
|
|
60
|
+
* wrong, where an unset one fails loudly.
|
|
61
|
+
*/
|
|
62
|
+
export declare const CLAUDE_CODE_SOURCE: ConfigSourceAdapter;
|
|
63
|
+
/**
|
|
64
|
+
* The adapter whose directory an absolute config path sits under, or `undefined` for a path that
|
|
65
|
+
* belongs to no registered dialect.
|
|
66
|
+
*
|
|
67
|
+
* Matched on the path SEGMENT rather than with `includes`, so a workspace that happens to live under
|
|
68
|
+
* `/home/me/.claude-backups/repo` does not read as a Claude Code source.
|
|
69
|
+
*/
|
|
70
|
+
export declare function adapterForConfigPath(path: string): ConfigSourceAdapter | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Variable references in a shell command that nothing will define.
|
|
73
|
+
*
|
|
74
|
+
* The second half of #522, and the half that cost the debugging session. `sh` expands an unset
|
|
75
|
+
* variable to the empty string and says nothing, so the failure surfaces ten characters later as a
|
|
76
|
+
* path: `bash: /.claude/hooks/guard.sh: No such file or directory` — which reads as "your script is
|
|
77
|
+
* missing" while the script is present and executable. Nothing in that message contains the name of
|
|
78
|
+
* the variable that was actually missing, so the reader looks in the wrong place.
|
|
79
|
+
*
|
|
80
|
+
* Checked against BOTH the process environment and the variables the dialect supplies, because
|
|
81
|
+
* either is a legitimate source: a hook may reasonably use `$HOME`.
|
|
82
|
+
*
|
|
83
|
+
* ## What it deliberately does not try to be
|
|
84
|
+
*
|
|
85
|
+
* This is not a shell parser. It finds `$NAME` and `${NAME}` outside single quotes, which is the
|
|
86
|
+
* shape a config file's hook commands take. It does NOT understand `${NAME:-default}` (a default
|
|
87
|
+
* makes the variable optional, so it is not reported), assignments earlier in the same command, or
|
|
88
|
+
* variables a sourced script exports. A false NEGATIVE there costs the old behaviour — the confusing
|
|
89
|
+
* path error — and a false positive would deny a hook that would have worked, so the parse errs
|
|
90
|
+
* toward silence and the check only ever ADDS a name to a failure that already happened.
|
|
91
|
+
*/
|
|
92
|
+
export declare function undefinedVariablesIn(command: string, supplied: Readonly<Record<string, string>>, env?: Readonly<Record<string, string | undefined>>): string[];
|
|
@@ -4,6 +4,15 @@ export interface HookCommand {
|
|
|
4
4
|
matcher?: string;
|
|
5
5
|
/** Optional timeout in ms; defaults to 30s. */
|
|
6
6
|
timeoutMs?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The config file this command was declared in.
|
|
9
|
+
*
|
|
10
|
+
* Carried so the executor can supply the runtime contract the declaring DIALECT presumes — a
|
|
11
|
+
* command from `.claude/settings.json` is written against Claude Code's runtime and expects
|
|
12
|
+
* `$CLAUDE_PROJECT_DIR` to exist (#522). Absent for a command built in memory, which is native by
|
|
13
|
+
* construction.
|
|
14
|
+
*/
|
|
15
|
+
sourcePath?: string;
|
|
7
16
|
}
|
|
8
17
|
export interface HookDecision {
|
|
9
18
|
decision: "allow" | "deny" | "feedback";
|
|
@@ -20,6 +20,15 @@ export interface HookCommand {
|
|
|
20
20
|
command: string;
|
|
21
21
|
matcher?: string;
|
|
22
22
|
timeoutMs?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The config file this command was declared in.
|
|
25
|
+
*
|
|
26
|
+
* Carried so the executor can supply the runtime contract the declaring DIALECT presumes — a
|
|
27
|
+
* command from `.claude/settings.json` is written against Claude Code's runtime and expects
|
|
28
|
+
* `$CLAUDE_PROJECT_DIR` to exist (#522). Absent for a command built in memory, which is native by
|
|
29
|
+
* construction.
|
|
30
|
+
*/
|
|
31
|
+
sourcePath?: string;
|
|
23
32
|
}
|
|
24
33
|
export interface HookConfig {
|
|
25
34
|
hooks?: Partial<Record<HookEvent, HookCommand[]>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk43ZQRWAP_cjs = require('./chunk-43ZQRWAP.cjs');
|
|
4
|
+
require('./chunk-AKJP2STZ.cjs');
|
|
5
|
+
require('./chunk-4CLOXP6H.cjs');
|
|
6
|
+
require('./chunk-4ZHTIJNE.cjs');
|
|
7
|
+
require('./chunk-XL7Q7HB2.cjs');
|
|
8
|
+
require('./chunk-EG4QM7ZJ.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(exports, "loadSubagents", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunk43ZQRWAP_cjs.loadSubagents; }
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=subagents-loader-UCNO7FUH.cjs.map
|
|
17
|
+
//# sourceMappingURL=subagents-loader-UCNO7FUH.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-UCNO7FUH.cjs"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { loadSubagents } from './chunk-LKBEROHN.js';
|
|
2
|
+
import './chunk-247ZTLNU.js';
|
|
3
|
+
import './chunk-LXQ6HKPS.js';
|
|
4
|
+
import './chunk-ZZMZWBR6.js';
|
|
5
|
+
import './chunk-D4CUGAKZ.js';
|
|
6
|
+
import './chunk-XEQ3TM66.js';
|
|
7
|
+
//# sourceMappingURL=subagents-loader-XP5ERVDZ.js.map
|
|
8
|
+
//# sourceMappingURL=subagents-loader-XP5ERVDZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-XP5ERVDZ.js"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk43ZQRWAP_cjs = require('./chunk-43ZQRWAP.cjs');
|
|
4
|
+
require('./chunk-AKJP2STZ.cjs');
|
|
5
5
|
require('./chunk-4CLOXP6H.cjs');
|
|
6
6
|
var chunk4ZHTIJNE_cjs = require('./chunk-4ZHTIJNE.cjs');
|
|
7
7
|
require('./chunk-XL7Q7HB2.cjs');
|
|
@@ -24,7 +24,7 @@ function resolveSources(options) {
|
|
|
24
24
|
}
|
|
25
25
|
async function discoverSubagents(cwd, options) {
|
|
26
26
|
const sources = resolveSources(options);
|
|
27
|
-
return
|
|
27
|
+
return chunk43ZQRWAP_cjs.loadSubagents(cwd, sources.includes("project"), void 0);
|
|
28
28
|
}
|
|
29
29
|
async function loadSubagentDefinition(name, cwd, options) {
|
|
30
30
|
return (await discoverSubagents(cwd, options))[name];
|
package/dist/subagents-loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadSubagents } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { loadSubagents } from './chunk-LKBEROHN.js';
|
|
2
|
+
import './chunk-247ZTLNU.js';
|
|
3
3
|
import './chunk-LXQ6HKPS.js';
|
|
4
4
|
import { ConfigurationError } from './chunk-ZZMZWBR6.js';
|
|
5
5
|
import './chunk-D4CUGAKZ.js';
|
package/docs/error-codes.md
CHANGED
|
@@ -68,11 +68,11 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
|
|
|
68
68
|
| `handoff_target_invalid` | domain | ConfigurationError | `packages/sdk-handoff/src/handoff.ts:116` |
|
|
69
69
|
| `handoff_target_required` | domain | ConfigurationError | `packages/sdk-handoff/src/handoff.ts:111` |
|
|
70
70
|
| `hitl_timeout` | domain | HitlTimeoutError | `packages/sdk/src/internal/runtime/tools/hitl-middleware.ts:39` |
|
|
71
|
-
| `hook_denied` | domain | ConfigurationError | `packages/sdk/src/internal/local-agent/local-agent.ts:
|
|
72
|
-
| `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:
|
|
73
|
-
| `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:
|
|
74
|
-
| `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:
|
|
75
|
-
| `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:
|
|
71
|
+
| `hook_denied` | domain | ConfigurationError | `packages/sdk/src/internal/local-agent/local-agent.ts:433` |
|
|
72
|
+
| `hooks_invalid_command` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:265` |
|
|
73
|
+
| `hooks_json_invalid` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:183` +2 |
|
|
74
|
+
| `hooks_read_error` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:174` |
|
|
75
|
+
| `hooks_unsupported_type` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/hooks/hooks-source.ts:259` |
|
|
76
76
|
| `interactive_unavailable` | domain | InteractiveUnavailableError | `packages/sdk/src/interactive/types.ts:20` |
|
|
77
77
|
| `INTERNAL_SERVER_ERROR` | domain | — | `packages/sdk/src/server/errors-envelope.ts:100` |
|
|
78
78
|
| `invalid_argument` | domain | TheokitAgentError | `packages/sdk/src/compaction.ts:79` |
|
package/package.json
CHANGED