@eddyskywalker/dsh-chatgpt-subscription 0.3.3 → 0.3.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.
@@ -1,8 +1,11 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
+ import type { SubagentRouteAuditDto } from '../shared/contracts.ts';
2
3
  import { OAuthService } from './oauth-service.ts';
3
4
  import { type SubscriptionPreferenceStore } from './preferences.ts';
4
5
  import type { ProxyManager } from './proxy-manager.ts';
5
6
  import type { SearchProviderSwitcher } from './search-provider-switcher.ts';
6
7
  import { UsageService } from './usage-service.ts';
7
- export declare function registerRoutes(ctx: Context, oauth: OAuthService, usage: UsageService, preferences: SubscriptionPreferenceStore, proxyManager?: ProxyManager, searchSwitcher?: SearchProviderSwitcher): () => void;
8
+ /** Read-only audit provider the optional route serves. */
9
+ export type RouteAuditReader = (sessionId: string) => Promise<SubagentRouteAuditDto>;
10
+ export declare function registerRoutes(ctx: Context, oauth: OAuthService, usage: UsageService, preferences: SubscriptionPreferenceStore, proxyManager?: ProxyManager, searchSwitcher?: SearchProviderSwitcher, routeAudit?: RouteAuditReader): () => void;
8
11
  //# sourceMappingURL=routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/host/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAmB,KAAK,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAA;AAIpE,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,2BAA2B,EACxC,YAAY,CAAC,EAAE,YAAY,EAC3B,cAAc,CAAC,EAAE,sBAAsB,GACtC,MAAM,IAAI,CAuKZ"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/host/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAIV,qBAAqB,EAEtB,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAmB,KAAK,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAA;AAIpE,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEpF,wBAAgB,cAAc,CAC5B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,2BAA2B,EACxC,YAAY,CAAC,EAAE,YAAY,EAC3B,cAAc,CAAC,EAAE,sBAAsB,EACvC,UAAU,CAAC,EAAE,gBAAgB,GAC5B,MAAM,IAAI,CA2LZ"}
@@ -24,6 +24,33 @@ export declare const SUBAGENT_MODEL_SELECTION_NAMESPACE = "subagent-model-select
24
24
  export declare const SUBAGENT_POLICY_EVENT = "subagent/model-selection-policy";
25
25
  /** Delegation tools whose child routes this guard authorizes. */
26
26
  export declare const DEFAULT_DELEGATION_TOOLS: readonly string[];
27
+ /**
28
+ * Delegation tools that start their child on the caller's own route by design.
29
+ * `subagent_fork` is the shipped one: it omits `modelSelectionSettings`, so it
30
+ * exposes no route parameters and seeds the child from the parent's own
31
+ * conversation — a child on any other route would discard the inherited prefix
32
+ * and its cache. Inherit mode is what keeps that design honest: the fork still
33
+ * cannot choose, but an allowlist-carrying Session now refuses to let it run on
34
+ * a route the user did not authorize.
35
+ */
36
+ export declare const DEFAULT_SUBAGENT_INHERIT_TOOLS: readonly string[];
37
+ /**
38
+ * How one delegation tool resolves the child route this guard authorizes.
39
+ *
40
+ * `explicit` — the tool exposes `provider`/`model`, so the call must name the
41
+ * pair and that pair must be on the allowlist.
42
+ * `inherit` — the tool declares no route parameters and starts the child on the
43
+ * caller's own route (the fork backend, whose whole value is reusing the
44
+ * parent's conversation and its cache). The guard then forbids a route override
45
+ * and checks the effective inherited route against the same allowlist, because
46
+ * "the tool cannot choose" is not the same as "the choice is authorized".
47
+ */
48
+ export type DelegationToolMode = 'explicit' | 'inherit';
49
+ /** One delegation tool name paired with the mode the guard enforces on it. */
50
+ export interface DelegationToolPolicy {
51
+ readonly name: string;
52
+ readonly mode: DelegationToolMode;
53
+ }
27
54
  /** One exact provider/model route the user authorized for children. */
28
55
  export interface AllowedModelRoute {
29
56
  readonly provider: string;
@@ -44,6 +71,17 @@ export interface PolicySession {
44
71
  readonly origin?: unknown;
45
72
  readonly parentSession?: unknown;
46
73
  };
74
+ /**
75
+ * The request header in force after the log's last header snapshot — the
76
+ * route the NEXT request uses. Read only by `inherit` mode, and optional so
77
+ * a minimal durable record still satisfies this interface.
78
+ */
79
+ requestHeader?(): {
80
+ readonly config?: {
81
+ readonly provider?: unknown;
82
+ readonly model?: unknown;
83
+ };
84
+ } | undefined;
47
85
  }
48
86
  /** Session lookup the guard walks from the calling agent to its ancestors. */
49
87
  export interface SessionsResolver {
@@ -62,6 +100,12 @@ export interface DelegationArguments {
62
100
  readonly provider?: unknown;
63
101
  readonly model?: unknown;
64
102
  }
103
+ /** The route an inherit-mode child would run on, as far as it can be resolved. */
104
+ export interface InheritedRoute {
105
+ readonly provider?: string;
106
+ readonly model?: string;
107
+ readonly reasoningEffort?: string;
108
+ }
65
109
  /**
66
110
  * Parse the allowlist out of a durable route-policy event.
67
111
  * @param data - `subagent/model-selection-policy` event payload.
@@ -90,6 +134,19 @@ export declare function authorizedRoutesFor(agent: AuthorizationAgent | undefine
90
134
  * @returns the resolved preference, or undefined without a settings service.
91
135
  */
92
136
  export declare function subagentModelSelectionPreference(settings: SettingsProvider | undefined): SubagentModelSelectionPreference | undefined;
137
+ /**
138
+ * Read the route an inherit-mode child would run on: the calling agent's own
139
+ * effective request route. This mirrors the delegation seam's
140
+ * `parentAgentOptionsForDelegation`, where the latest request header owns
141
+ * provider/model after request-time model selection and the creation options
142
+ * remain the fallback before the first request. `AuthorizationAgent.options` is
143
+ * deliberately NOT a fallback while a header exists — after a mid-session model
144
+ * switch the creation options are stale, and trusting them would authorize the
145
+ * route the session no longer uses.
146
+ * @param agent - Calling agent.
147
+ * @returns the inherited route fields, each absent when its source did not supply it.
148
+ */
149
+ export declare function inheritedRouteOf(agent: AuthorizationAgent | undefined): InheritedRoute;
93
150
  /**
94
151
  * Build the denial reason for a delegation that named no explicit route.
95
152
  * A policy-carrying Session requires the model to choose, so the reason names
@@ -118,6 +175,29 @@ export declare function partialRouteReason(missing: 'provider' | 'model', suppli
118
175
  * @returns the corrective reason handed back to the model.
119
176
  */
120
177
  export declare function unauthorizedRouteReason(provider: string | undefined, model: string | undefined, allowed: readonly AllowedModelRoute[], explicit: boolean): string;
178
+ /**
179
+ * Build the denial reason for an inherit-mode delegation that named a route.
180
+ * The fork backend accepts no route parameters, so a named pair is not a
181
+ * partial override the backend would ignore — it is a request to change the
182
+ * route, which is exactly what an inherit-mode tool exists to prevent.
183
+ * @param toolName - the tool the model called.
184
+ * @param provider - the provider the call named.
185
+ * @param model - the model the call named.
186
+ * @returns the corrective reason handed back to the model.
187
+ */
188
+ export declare function inheritOverrideReason(toolName: string, provider: string, model: string): string;
189
+ /**
190
+ * Build the denial reason for an inherit-mode delegation whose inherited route
191
+ * is outside the allowlist. Unlike the explicit case this is not something the
192
+ * call can fix by naming a route, so the reason points at the tool that can.
193
+ * @param toolName - the tool the model called.
194
+ * @param provider - the parent route the child would inherit, when known.
195
+ * @param model - the parent model the child would inherit, when known.
196
+ * @param allowed - Routes the calling Session authorizes.
197
+ * @param reasoningEffort - the inherited effort, when the header recorded one.
198
+ * @returns the corrective reason handed back to the model.
199
+ */
200
+ export declare function inheritRouteDenialReason(toolName: string, provider: string | undefined, model: string | undefined, allowed: readonly AllowedModelRoute[], reasoningEffort?: string): string;
121
201
  /** Which Session's recorded allowlist a delegation must respect. */
122
202
  export type AuthorizationScope =
123
203
  /**
@@ -132,6 +212,15 @@ export type AuthorizationScope =
132
212
  * Session. A Session that recorded its own routes still outranks it.
133
213
  */
134
214
  | 'preference';
215
+ /**
216
+ * Resolve one tool's enforcement mode from the configured policies. An
217
+ * unconfigured name is `undefined`: the guard does not police it, which is how
218
+ * the plain-name configuration keeps its existing meaning.
219
+ * @param policies - Configured tool policies in precedence order.
220
+ * @param toolName - Tool being dispatched.
221
+ * @returns the first matching mode, or undefined when the guard ignores the tool.
222
+ */
223
+ export declare function delegationModeOf(policies: readonly DelegationToolPolicy[], toolName: string): DelegationToolMode | undefined;
135
224
  /**
136
225
  * Decide whether one delegation call may start its child.
137
226
  * @param agent - Calling agent.
@@ -139,19 +228,22 @@ export type AuthorizationScope =
139
228
  * @param args - Parsed tool arguments.
140
229
  * @param preference - Current Host preference, when the settings service exists.
141
230
  * @param sessions - Session registry used for ancestor lookup.
142
- * @param toolNames - Delegation tool names this guard authorizes.
231
+ * @param toolNames - Delegation tool names this guard authorizes (explicit mode).
143
232
  * @param scope - Whether an unrecorded Session falls back to the preference.
233
+ * @param inheritToolNames - Delegation tools that start a child on the caller's own route.
144
234
  * @returns a denial reason, or undefined to leave the call untouched.
145
235
  */
146
- export declare function delegationDenialReason(agent: AuthorizationAgent | undefined, toolName: string, args: unknown, preference: SubagentModelSelectionPreference | undefined, sessions: SessionsResolver, toolNames?: readonly string[], scope?: AuthorizationScope): string | undefined;
236
+ export declare function delegationDenialReason(agent: AuthorizationAgent | undefined, toolName: string, args: unknown, preference: SubagentModelSelectionPreference | undefined, sessions: SessionsResolver, toolNames?: readonly string[], scope?: AuthorizationScope, inheritToolNames?: readonly string[]): string | undefined;
147
237
  /** Runtime inputs the guard closes over. */
148
238
  export interface SubagentAuthorizationOptions {
149
239
  /** Live settings service, when composed; absent leaves recorded policies in charge. */
150
240
  readonly settings?: SettingsProvider;
151
241
  /** Session registry used for ancestor lookup. */
152
242
  readonly sessions: SessionsResolver;
153
- /** Exact delegation tool names this guard authorizes. */
243
+ /** Exact delegation tool names this guard authorizes (explicit route selection). */
154
244
  readonly toolNames: readonly string[];
245
+ /** Delegation tools that run their child on the caller's own route. */
246
+ readonly inheritToolNames?: readonly string[];
155
247
  /** Whether an unrecorded Session falls back to the current preference. */
156
248
  readonly scope?: AuthorizationScope;
157
249
  }
@@ -167,6 +259,22 @@ export type DelegationGuard = (agent: AuthorizationAgent | undefined, toolName:
167
259
  export declare function createSubagentAuthorization(options: SubagentAuthorizationOptions): DelegationGuard;
168
260
  /** Delegation names this guard recognizes when configuration omits them. */
169
261
  export declare function normalizeDelegationToolNames(value: unknown): string[];
262
+ /**
263
+ * Normalize the configured inherit-mode names. Unlike
264
+ * {@link normalizeDelegationToolNames}, an empty array is a deliberate opt-out
265
+ * (`[]`) rather than a request for the default, and `undefined` selects the
266
+ * shipped default.
267
+ * @param value - Candidate configuration value.
268
+ * @returns the exact inherit-mode names this guard enforces.
269
+ */
270
+ export declare function normalizeInheritToolNames(value: unknown): string[];
271
+ /**
272
+ * Validate the configured inherit-mode names. Emptiness is legal here — it
273
+ * disables inherit enforcement — but a malformed entry is not.
274
+ * @param toolNames - Candidate inherit-mode delegation tool names.
275
+ * @returns the exact names this guard enforces in inherit mode.
276
+ */
277
+ export declare function validateInheritToolNames(toolNames: readonly string[]): string[];
170
278
  /**
171
279
  * Validate the plugin configuration that owns this guard.
172
280
  * @param toolNames - Candidate delegation tool names.
@@ -175,8 +283,10 @@ export declare function normalizeDelegationToolNames(value: unknown): string[];
175
283
  export declare function validateDelegationToolNames(toolNames: readonly string[]): string[];
176
284
  /** Configuration accepted by {@link installSubagentModelAuthorization}. */
177
285
  export interface SubagentModelAuthorizationConfig {
178
- /** Delegation tool names the guard authorizes. */
286
+ /** Delegation tool names the guard authorizes (explicit route selection). */
179
287
  readonly toolNames?: readonly string[];
288
+ /** Delegation tools that run their child on the caller's own route. */
289
+ readonly inheritToolNames?: readonly string[];
180
290
  /** Whether an unrecorded Session falls back to the current preference. */
181
291
  readonly scope?: AuthorizationScope;
182
292
  }
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-model-authorization.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-model-authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAIjE,kEAAkE;AAClE,eAAO,MAAM,kCAAkC,6BAA6B,CAAA;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,oCAAoC,CAAA;AAEtE,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAiB,CAAA;AAEvE,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,gFAAgF;AAChF,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,aAAa,EAAE,SAAS,iBAAiB,EAAE,CAAA;CACrD;AAED,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,CAAC,G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B,KAAK,EAAE,kBAAkB,GAAG,SAAS,EACrC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,KACV,MAAM,GAAG,SAAS,CAAA;AAEvB;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,eAAe,CAUjB;AAED,4EAA4E;AAC5E,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAKrE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAUlF;AAED,2EAA2E;AAC3E,MAAM,WAAW,gCAAgC;IAC/C,kDAAkD;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,GAAE,gCAAqC,GAC5C,MAAM,IAAI,CAOZ;AACD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAK7E"}
1
+ {"version":3,"file":"subagent-model-authorization.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-model-authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAIjE,kEAAkE;AAClE,eAAO,MAAM,kCAAkC,6BAA6B,CAAA;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,oCAAoC,CAAA;AAEtE,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAiB,CAAA;AA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tC,uEAAuE;IACvE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7C,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,GAAE,gCAAqC,GAC5C,MAAM,IAAI,CAcZ;AACD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAK7E"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Post-hoc visibility for child routes the delegation guard cannot pre-empt.
3
+ *
4
+ * `subagentModelAuthorization` gates one model-authored tool call. Two whole
5
+ * classes of child creation never pass through such a call, so no tool guard can
6
+ * see them:
7
+ *
8
+ * - a delegation tool that exposes no route parameters and inherits the
9
+ * caller's route (`subagent_fork`);
10
+ * - a subsystem that starts children itself without any delegation tool at all
11
+ * (`ralph`, the `workflow` engine, a plugin calling `ctx.subagents.start`).
12
+ *
13
+ * Every session-backed child still leaves two durable facts, which is enough to
14
+ * reconstruct what actually ran:
15
+ *
16
+ * - the parent records one `subagent/catalog` event per continuable child, and
17
+ * the child's own session header names its `parentSession`;
18
+ * - the child records one immutable `subagent/descriptor` whose
19
+ * `agentProvider`/`agentModel` are the resolved child route (absent when the
20
+ * child inherited the parent's route, which is the common case).
21
+ *
22
+ * This module folds those facts into an advisory list. It never blocks and never
23
+ * mutates a session: its whole job is to make an unauthorized child route
24
+ * visible instead of silent.
25
+ * @module dsh-chatgpt-subscription/subagent-route-audit
26
+ */
27
+ /** One record of a child session whose route is known. */
28
+ export interface ChildRouteFinding {
29
+ /** The child session id. */
30
+ readonly childId: string;
31
+ /** The parent session id, when the child's header names one. */
32
+ readonly parentId?: string;
33
+ /** The `ctx.subagents` provider that established the child. */
34
+ readonly provider?: string;
35
+ /** The child's own resolved provider, absent when it inherited the parent's. */
36
+ readonly childProvider?: string;
37
+ /** The child's own resolved model, absent when it inherited the parent's. */
38
+ readonly childModel?: string;
39
+ /** Short display label recorded with the descriptor. */
40
+ readonly label?: string;
41
+ }
42
+ /** One child that ran on a route the governing allowlist does not authorize. */
43
+ export interface RouteViolation {
44
+ /** The child that ran on the unauthorized route. */
45
+ readonly finding: ChildRouteFinding;
46
+ /**
47
+ * The route the child actually ran on. For a route-preserving child this is
48
+ * the parent's route, which is why the finding keeps both.
49
+ */
50
+ readonly route: {
51
+ readonly provider?: string;
52
+ readonly model?: string;
53
+ };
54
+ /**
55
+ * Whether the child's route equals its parent's current route.
56
+ *
57
+ * This is deliberately a comparison rather than a claim about which mechanism
58
+ * chose the route. A forked child's descriptor DOES record the route it ran
59
+ * on — the delegation seam stamps the parent's route into the child's options
60
+ * — so a descriptor alone cannot prove whether the child inherited the route
61
+ * or was handed it explicitly. Equality is the checkable fact, and it is the
62
+ * one that decides whether re-delegating through an explicit tool would even
63
+ * change anything.
64
+ */
65
+ readonly sameAsParent: boolean;
66
+ }
67
+ /** One exact provider/model route authorized for children. */
68
+ export interface AuditedRoute {
69
+ readonly provider: string;
70
+ readonly model: string;
71
+ }
72
+ /** Minimal session view this fold reads: the header and the ordered event log. */
73
+ export interface AuditedSession {
74
+ readonly id?: unknown;
75
+ readonly header?: {
76
+ readonly parentSession?: unknown;
77
+ readonly origin?: unknown;
78
+ };
79
+ readonly events?: readonly {
80
+ readonly type?: unknown;
81
+ readonly data?: unknown;
82
+ }[];
83
+ }
84
+ /** Session lookup used to resolve a child's parent for inherited-route attribution. */
85
+ export interface AuditedSessions {
86
+ get(id: string): AuditedSession | undefined;
87
+ }
88
+ /**
89
+ * Extract the child route a descriptor recorded.
90
+ * @param data - `subagent/descriptor` payload.
91
+ * @returns the declared route fields plus provider and label, each when present.
92
+ */
93
+ export declare function readChildDescriptor(data: unknown): Omit<ChildRouteFinding, 'childId' | 'parentId'> | undefined;
94
+ /**
95
+ * Read the child-route allowlist a session recorded, from its own log.
96
+ *
97
+ * The live guard reads the same event through `policyRoutesOf`, which walks a
98
+ * session's `eventAt` accessor. The audit holds a resolved session instead, so
99
+ * it scans the snapshot it already has rather than reopening the log per child.
100
+ * @param session - the session whose policy is read.
101
+ * @returns the authorized routes, or undefined when the session recorded none.
102
+ */
103
+ export declare function auditedRoutesOf(session: AuditedSession): AuditedRoute[] | undefined;
104
+ /**
105
+ * Collect the child routes one parent session recorded.
106
+ *
107
+ * Discovery uses both durable signals because they cover different backends: a
108
+ * `subagent/catalog` event names every continuable child the parent created,
109
+ * while a descriptor-less or one-shot child is only reachable by scanning the
110
+ * registry for a session whose header names this parent.
111
+ * @param parent - the parent session to inspect.
112
+ * @param sessions - registry used to resolve each child's own log and header.
113
+ * @returns one finding per child whose route could be read.
114
+ */
115
+ export declare function childRoutesOf(parent: AuditedSession, sessions: AuditedSessions): ChildRouteFinding[];
116
+ /**
117
+ * Resolve the route a finding actually ran on, following the parent when the
118
+ * child recorded none, and report whether it matches the parent's.
119
+ * @param finding - the child under audit.
120
+ * @param sessions - registry used to resolve the parent.
121
+ * @returns the effective route and whether it equals the parent's route.
122
+ */
123
+ export declare function effectiveRouteOf(finding: ChildRouteFinding, sessions: AuditedSessions): RouteViolation['route'] & {
124
+ sameAsParent: boolean;
125
+ };
126
+ /**
127
+ * Fold one parent session's children into the violations worth reporting.
128
+ * A finding with an unresolvable route is reported as neither: guessing would
129
+ * turn this advisory list into a source of false accusations.
130
+ * @param parent - the parent session to audit.
131
+ * @param sessions - registry used to resolve children and parents.
132
+ * @param allowed - routes the parent Session authorized, when it recorded any.
133
+ * @returns violations, ordered as the children were discovered.
134
+ */
135
+ export declare function auditChildRoutes(parent: AuditedSession, sessions: AuditedSessions, allowed: readonly AuditedRoute[] | undefined): RouteViolation[];
136
+ /**
137
+ * Render one violation as a single model-facing line.
138
+ * @param violation - the violation to describe.
139
+ * @returns a one-line summary naming the child, its route, and its origin.
140
+ */
141
+ export declare function violationText(violation: RouteViolation): string;
142
+ //# sourceMappingURL=subagent-route-audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-route-audit.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-route-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAA;IACnC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACvE;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;CAC/B;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAA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(default `subagent`). */
20
20
  subagentModelTools?: string[];
21
+ /**
22
+ * Delegation tools that always run their child on the calling agent's route
23
+ * and therefore expose no `provider`/`model` (default `['subagent_fork']`).
24
+ * An allowlist-carrying Session then still denies the call when the inherited
25
+ * route is not authorized, instead of silently running an unauthorized child.
26
+ * Set `[]` to leave these tools on the built-in behavior.
27
+ */
28
+ subagentModelInheritTools?: string[];
21
29
  /**
22
30
  * `session` (default) enforces the allowlist a Session recorded, matching the
23
31
  * delegation tool's snapshot; `preference` also enforces the current Settings
@@ -31,7 +39,9 @@ export declare function apply(ctx: Context, pluginConfig?: Config): void;
31
39
  export { RELAY_PROBE_ENV, RELAY_PROBE_FILE_ENV, RELAY_PROBE_FILE_NAME, RELAY_PROBE_MAX_BYTES, RELAY_SOURCE_KINDS, RelayProbe, createFileRelayProbeSink, installRelayProbe, relayProbeEnabled, relayProbeEnvFile, relayProbeEnvValue, relayProbeLogPath, } from './host/relay-probe.ts';
32
40
  export type { AgentsLookup, ProbeAgent, ProbeEvent, ProbeSession, RelayProbeContext, RelayProbeOptions, RelayProbeSink, } from './host/relay-probe.ts';
33
41
  export { ProxyManager, detectSystemProxy } from './host/proxy-manager.ts';
34
- export { SUBAGENT_MODEL_SELECTION_NAMESPACE, SUBAGENT_POLICY_EVENT, authorizedRoutesFor, createSubagentAuthorization, delegationDenialReason, installSubagentModelAuthorization, normalizeDelegationToolNames, parseAllowedRoutes, policyRoutesOf, subagentModelSelectionPreference, unauthorizedRouteReason, validateAuthorizationScope, validateDelegationToolNames, } from './host/subagent-model-authorization.ts';
42
+ export { DEFAULT_SUBAGENT_INHERIT_TOOLS, SUBAGENT_MODEL_SELECTION_NAMESPACE, SUBAGENT_POLICY_EVENT, authorizedRoutesFor, createSubagentAuthorization, delegationDenialReason, delegationModeOf, inheritOverrideReason, inheritRouteDenialReason, inheritedRouteOf, installSubagentModelAuthorization, normalizeDelegationToolNames, normalizeInheritToolNames, parseAllowedRoutes, policyRoutesOf, subagentModelSelectionPreference, unauthorizedRouteReason, validateAuthorizationScope, validateDelegationToolNames, validateInheritToolNames, } from './host/subagent-model-authorization.ts';
43
+ export { auditChildRoutes, auditedRoutesOf, childRoutesOf, effectiveRouteOf, readChildDescriptor, violationText, } from './host/subagent-route-audit.ts';
44
+ export type { AuditedRoute, AuditedSession, AuditedSessions, ChildRouteFinding, RouteViolation, } from './host/subagent-route-audit.ts';
35
45
  export { OAuthService } from './host/oauth-service.ts';
36
46
  export { CodexChatGptAdapter } from './host/adapter.ts';
37
47
  export { createCodexImageTool } from './host/codex-images.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAyExC,yDAAyD;AACzD,MAAM,WAAW,MAAM;IACrB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;CAC9C;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAK3B,CAAA;AAEF,eAAO,MAAM,MAAM,UAAqE,CAAA;AAExF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,GAAE,MAAW,GAAG,IAAI,CA4RnE;AAED,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,YAAY,EACZ,UAAU,EAC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,EAC1C,0BAA0B,IAAI,kCAAkC,GACjE,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,iBAAiB,IAAI,kBAAkB,EACvC,aAAa,IAAI,qBAAqB,EACtC,kBAAkB,IAAI,kBAAkB,EACxC,gBAAgB,IAAI,kBAAkB,EACtC,cAAc,IAAI,gBAAgB,GACnC,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACzF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,GAClB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAClG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA"}
@@ -130,8 +130,29 @@ export type LoginEventDto = {
130
130
  loginId: string;
131
131
  error: PublicErrorDto;
132
132
  };
133
+ /** One child that ran on a route the governing allowlist did not authorize. */
134
+ export interface SubagentRouteViolationDto {
135
+ childId: string;
136
+ parentId: string | null;
137
+ provider: string | null;
138
+ label: string | null;
139
+ routeProvider: string | null;
140
+ routeModel: string | null;
141
+ /** Whether the child's route equals its parent's current route. */
142
+ sameAsParent: boolean;
143
+ }
144
+ /** Advisory audit of child routes for one parent session. */
145
+ export interface SubagentRouteAuditDto {
146
+ sessionId: string;
147
+ /** Exact authorized routes the audit compared against. */
148
+ allowedModels: {
149
+ provider: string;
150
+ model: string;
151
+ }[];
152
+ violations: SubagentRouteViolationDto[];
153
+ }
133
154
  export interface PublicErrorDto {
134
- code: 'bad-request' | 'csrf-rejected' | 'login-active' | 'login-cancelled' | 'login-expired' | 'oauth-callback-invalid' | 'oauth-token-exchange-failed' | 'not-authenticated' | 'refresh-failed' | 'storage-failed' | 'connection-failed' | 'quota-failed' | 'preference-failed' | 'rate-limited' | 'internal';
155
+ code: 'bad-request' | 'csrf-rejected' | 'login-active' | 'login-cancelled' | 'login-expired' | 'oauth-callback-invalid' | 'oauth-token-exchange-failed' | 'not-authenticated' | 'refresh-failed' | 'storage-failed' | 'connection-failed' | 'quota-failed' | 'preference-failed' | 'rate-limited' | 'route-audit-failed' | 'internal';
135
156
  message: string;
136
157
  }
137
158
  export type ApiEnvelope<T> = {
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/shared/contracts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,QAAQ,CAAA;AAEZ,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,oBAAoB,CAAA;IAC7B,KAAK,EAAE;QACL,MAAM,EAAE,OAAO,CAAA;QACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;QACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KACzB,CAAA;IACD,KAAK,EAAE,cAAc,CAAA;IACrB,WAAW,EAAE,0BAA0B,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,CAA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AG,IAAI,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,mEAAmE;IACnE,YAAY,EAAE,OAAO,CAAA;CACtB;AAED,6DAA6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,0DAA0D;IAC1D,aAAa,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACpD,UAAU,EAAE,yBAAyB,EAAE,CAAA;CACxC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EACA,aAAa,GACb,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,wBAAwB,GACxB,6BAA6B,GAC7B,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,oBAAoB,GACpB,UAAU,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACtB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eddyskywalker/dsh-chatgpt-subscription",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "DSH provider plugin for Codex access through a ChatGPT subscription.",
5
5
  "author": {
6
6
  "name": "eddyskywalker",
@@ -81,7 +81,8 @@
81
81
  - 照常按 R3–R6 派发与验收,只是不再写出 route 这一行。
82
82
  - 唯一需要顺带一提的例外:如果你判断某个任务明显更适合用另一个模型(例如机械重构 vs 深度推理),可以用一句话告诉用户可以到「设置 → 子代理」打开开关并新开一个会话,然后继续用默认方式把当前任务做完——不要为此停下等待。该设置只对新建会话生效,不追溯已有会话。
83
83
 
84
- 例外:subagent_fork 刻意与父代理同路由(复用对话与 KV Cache),只用于需要主代理上下文的审查,不得当作偷懒的替身。
84
+ subagent_fork 刻意与父代理同路由(复用对话与 KV Cache),只用于需要主代理上下文的审查,不得当作偷懒的替身。
85
+ 它没有 provider/model 参数,路由由你自己决定,因此【可用时】的显式路由规则对它不适用。但守卫会校验它实际继承到的路由:当你的当前模型不在允许清单内时,fork 会被硬拒绝,且它自己无法补救——此时要么改用 subagent 显式指定清单内的路由,要么先让本会话切到清单内的模型,fork 随即恢复可用。
85
86
  选择依据是任务性质与模型能力;同一批次内同类任务保持一致。
86
87
 
87
88
  ## R3 · 子代理自治