@huanlin/dsh-plugin-yet-another-subagent 0.1.3 → 0.1.4
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/lib/client.js +1578 -1578
- package/lib/index.js +5487 -5487
- package/lib/types/client/SettingsPage.d.ts +49 -0
- package/lib/types/client/SubagentCard.d.ts +56 -0
- package/lib/types/client/SubagentTreeView.d.ts +63 -0
- package/lib/types/client/index.d.ts +29 -0
- package/lib/types/client/locales.d.ts +13 -0
- package/lib/types/index.d.ts +42 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/profile-store.d.ts +59 -0
- package/lib/types/projection.d.ts +103 -0
- package/lib/types/repair.d.ts +49 -0
- package/lib/types/rpc.d.ts +59 -0
- package/lib/types/tool-factory.d.ts +45 -0
- package/lib/types/types.d.ts +116 -0
- package/package.json +4 -3
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile data model for yet-another-subagent.
|
|
3
|
+
*
|
|
4
|
+
* @module @huanlin/dsh-plugin-yet-another-subagent/types
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentOptions } from '@deepseek-ai/dsh-agent';
|
|
7
|
+
/** A model-facing tool name is `subagent_<id>`. */
|
|
8
|
+
export interface SubagentProfile {
|
|
9
|
+
/** Unique id; lowercase letters, digits, hyphens; 1–32 chars. Used as `subagent_<id>`. */
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** Display name (nav label / card title). */
|
|
12
|
+
readonly label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Model selection. `kind: 'auto'` inherits the parent model (provider/model
|
|
15
|
+
* are ignored); `kind: 'manual'` pins a specific provider/model.
|
|
16
|
+
*/
|
|
17
|
+
readonly model: {
|
|
18
|
+
readonly kind: 'auto' | 'manual';
|
|
19
|
+
readonly provider: string;
|
|
20
|
+
readonly model: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Persona selection. `kind: 'inherit'` omits the per-child persona so the
|
|
24
|
+
* child uses the deployment `system-prompt` persona (same as the official
|
|
25
|
+
* `tool-subagent` default when no `persona` is configured). `kind: 'custom'`
|
|
26
|
+
* shadows the deployment persona with the provided text.
|
|
27
|
+
*/
|
|
28
|
+
readonly persona: {
|
|
29
|
+
readonly kind: 'inherit';
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'custom';
|
|
32
|
+
readonly text: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Tool filter selection. `kind: 'none'` applies no filter (child sees every
|
|
36
|
+
* visible global tool). `kind: 'allow'` keeps only the named tools;
|
|
37
|
+
* `kind: 'deny'` removes the named tools. The chosen tools are only sent to
|
|
38
|
+
* the provider when `kind` is not `'none'`.
|
|
39
|
+
*/
|
|
40
|
+
readonly toolFilter: {
|
|
41
|
+
readonly kind: 'none';
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'allow';
|
|
44
|
+
readonly tools: readonly string[];
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: 'deny';
|
|
47
|
+
readonly tools: readonly string[];
|
|
48
|
+
};
|
|
49
|
+
/** Maximum delegation depth (non-negative safe integer); default 3. */
|
|
50
|
+
readonly maxDepth: number;
|
|
51
|
+
/**
|
|
52
|
+
* Background policy when `run_in_background: true` is set. `'continuable'`
|
|
53
|
+
* (default, matches the base bundle) starts a background subagent that keeps
|
|
54
|
+
* its conversation — the caller receives only its subagent id and sends more
|
|
55
|
+
* work via `send_message`. `'one-shot'` starts a background task that returns
|
|
56
|
+
* a job id — the caller collects the result with `job_output` and stops it
|
|
57
|
+
* with `job_kill`.
|
|
58
|
+
*/
|
|
59
|
+
readonly backgroundMode: 'continuable' | 'one-shot';
|
|
60
|
+
/**
|
|
61
|
+
* Whether this profile is part of the bundle seed (cordis.patch.yml) and
|
|
62
|
+
* therefore labelled `builtin` in the UI. User-added profiles are `false`.
|
|
63
|
+
* Builtin profiles can still be edited or removed (unless `generalFixed`
|
|
64
|
+
* protects them); the flag is purely a presentation hint.
|
|
65
|
+
*/
|
|
66
|
+
readonly builtin: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** Top-level config. */
|
|
69
|
+
export interface YaSubagentConfig {
|
|
70
|
+
/** Initial profile list (cordis.yml layer). Runtime mutations live in memory only. */
|
|
71
|
+
readonly profiles: readonly SubagentProfile[];
|
|
72
|
+
/** When true, the `general` profile cannot be removed. */
|
|
73
|
+
readonly generalFixed: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Coerce a possibly-stale profile shape (from an older `settings.yaml` or a
|
|
77
|
+
* caller that still uses the legacy `persona?: string` / `toolFilter?: { allow?, deny? }`
|
|
78
|
+
* form) into the current {@link SubagentProfile} shape. Idempotent on already-
|
|
79
|
+
* current shapes.
|
|
80
|
+
*
|
|
81
|
+
* Rules:
|
|
82
|
+
* - `persona: undefined | '' | null` → `{ kind: 'inherit' }`
|
|
83
|
+
* - `persona: string` (non-empty) → `{ kind: 'custom', text }`
|
|
84
|
+
* - `persona: { kind: 'inherit' }` → as-is
|
|
85
|
+
* - `persona: { kind: 'custom', text }` → as-is (text trimmed; empty → inherit)
|
|
86
|
+
* - `toolFilter: undefined | null` → `{ kind: 'none' }`
|
|
87
|
+
* - `toolFilter: { allow: [...], deny: [...] }` → allow wins if non-empty, else deny, else none
|
|
88
|
+
* - `toolFilter: { kind: 'none' | 'allow' | 'deny', tools? }` → as-is (tools defaulted to [])
|
|
89
|
+
* - `builtin: undefined | null` → `false`
|
|
90
|
+
*/
|
|
91
|
+
export declare function migrateProfile(input: unknown): SubagentProfile;
|
|
92
|
+
/** Derive agentOptions from a profile's model selection. */
|
|
93
|
+
export declare function agentOptionsFor(profile: SubagentProfile): {
|
|
94
|
+
readonly agentOptions?: AgentOptions;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Project the persona field onto the request shape: `undefined` for `inherit`
|
|
98
|
+
* (omit the field so the child uses the deployment persona) and the text for
|
|
99
|
+
* `custom`.
|
|
100
|
+
*/
|
|
101
|
+
export declare function personaForRequest(profile: SubagentProfile): {
|
|
102
|
+
readonly persona?: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Project the toolFilter field onto the request shape: `undefined` for `none`
|
|
106
|
+
* (omit the field so the child sees every visible tool) and the allow/deny
|
|
107
|
+
* pair for `allow`/`deny`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function toolFilterForRequest(profile: SubagentProfile): {
|
|
110
|
+
readonly toolFilter?: {
|
|
111
|
+
readonly allow?: readonly string[];
|
|
112
|
+
readonly deny?: readonly string[];
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
/** Validate a profile id: lowercase letters, digits, hyphens; 1–32 chars. */
|
|
116
|
+
export declare function isValidProfileId(id: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanlin/dsh-plugin-yet-another-subagent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -54,9 +54,10 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
|
-
"
|
|
57
|
+
"prebuild": "node scripts/relink-deps.mjs",
|
|
58
|
+
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
58
59
|
"test": "vitest run",
|
|
59
|
-
"build": "
|
|
60
|
+
"build": "tsdown -c tsdown.config.ts && tsc -p tsconfig.typecheck.json",
|
|
60
61
|
"bundle:client": "tsdown -c tsdown.config.ts"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|