dsh-thinking-guard 0.1.17 → 0.1.20
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 +40 -130
- package/cordis.patch.yml +5 -0
- package/lib/client.d.ts +8 -2
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +4627 -6732
- package/lib/guard-core.js +74 -15
- package/lib/guard-core.js.map +1 -1
- package/lib/guard-loop-core.js +158 -24
- package/lib/guard-loop-core.js.map +1 -1
- package/lib/guard.js +228 -85
- package/lib/guard.js.map +1 -1
- package/lib/host-face.js +1 -0
- package/lib/host-face.js.map +1 -1
- package/lib/index.js +11 -1
- package/lib/index.js.map +1 -1
- package/lib/invoke.js +16 -10
- package/lib/invoke.js.map +1 -1
- package/lib/policy-state.js +29 -1
- package/lib/policy-state.js.map +1 -1
- package/lib/policy.js +178 -10
- package/lib/policy.js.map +1 -1
- package/lib/registry.js +12 -2
- package/lib/registry.js.map +1 -1
- package/lib/server/call-index-remote.js +110 -0
- package/lib/server/call-index-remote.js.map +1 -0
- package/lib/server/remote.js +13 -0
- package/lib/server/remote.js.map +1 -1
- package/lib/types/guard-core.d.ts +91 -6
- package/lib/types/guard-core.d.ts.map +1 -1
- package/lib/types/guard-loop-core.d.ts +64 -3
- package/lib/types/guard-loop-core.d.ts.map +1 -1
- package/lib/types/guard.d.ts +7 -1
- package/lib/types/guard.d.ts.map +1 -1
- package/lib/types/host-face.d.ts.map +1 -1
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/invoke.d.ts.map +1 -1
- package/lib/types/policy-state.d.ts +6 -0
- package/lib/types/policy-state.d.ts.map +1 -1
- package/lib/types/policy.d.ts +34 -3
- package/lib/types/policy.d.ts.map +1 -1
- package/lib/types/registry.d.ts.map +1 -1
- package/lib/types/server/call-index-remote.d.ts +17 -0
- package/lib/types/server/call-index-remote.d.ts.map +1 -0
- package/lib/types/server/remote.d.ts +9 -0
- package/lib/types/server/remote.d.ts.map +1 -1
- package/lib/types/usage/call-index-core.d.ts +152 -0
- package/lib/types/usage/call-index-core.d.ts.map +1 -0
- package/lib/types/usage/call-index-host-face.d.ts +44 -0
- package/lib/types/usage/call-index-host-face.d.ts.map +1 -0
- package/lib/types/usage/call-index-host.d.ts +7 -0
- package/lib/types/usage/call-index-host.d.ts.map +1 -0
- package/lib/types/usage/call-index-query.d.ts +97 -0
- package/lib/types/usage/call-index-query.d.ts.map +1 -0
- package/lib/types/usage/call-index-runtime.d.ts +46 -0
- package/lib/types/usage/call-index-runtime.d.ts.map +1 -0
- package/lib/types/usage/call-index-scope.d.ts +59 -0
- package/lib/types/usage/call-index-scope.d.ts.map +1 -0
- package/lib/types/usage/call-index-wire.d.ts +286 -0
- package/lib/types/usage/call-index-wire.d.ts.map +1 -0
- package/lib/types/usage/session-index.d.ts +149 -0
- package/lib/types/usage/session-index.d.ts.map +1 -0
- package/lib/usage/call-index-core.js +761 -0
- package/lib/usage/call-index-core.js.map +1 -0
- package/lib/usage/call-index-host-face.js +77 -0
- package/lib/usage/call-index-host-face.js.map +1 -0
- package/lib/usage/call-index-host.js +13 -0
- package/lib/usage/call-index-host.js.map +1 -0
- package/lib/usage/call-index-query.js +669 -0
- package/lib/usage/call-index-query.js.map +1 -0
- package/lib/usage/call-index-runtime.js +376 -0
- package/lib/usage/call-index-runtime.js.map +1 -0
- package/lib/usage/call-index-scope.js +79 -0
- package/lib/usage/call-index-scope.js.map +1 -0
- package/lib/usage/call-index-wire.js +490 -0
- package/lib/usage/call-index-wire.js.map +1 -0
- package/lib/usage/session-index.js +600 -0
- package/lib/usage/session-index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type CallIndexSourceResolver } from './call-index-core.ts';
|
|
2
|
+
export interface SessionCallIndexOptions {
|
|
3
|
+
getMode: () => unknown;
|
|
4
|
+
getBackend: () => unknown;
|
|
5
|
+
/** Optional public SessionStore membership; it never supplies historical content. */
|
|
6
|
+
isLiveSession?: (id: string) => boolean;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
maxBytes?: number;
|
|
9
|
+
maxCalls?: number;
|
|
10
|
+
maxSessions?: number;
|
|
11
|
+
maxEventsPerSession?: number;
|
|
12
|
+
maxOrphans?: number;
|
|
13
|
+
maxLiveQueue?: number;
|
|
14
|
+
now?: () => number;
|
|
15
|
+
yield?: () => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Provenance resolver built from trusted catalog evidence by the runtime.
|
|
18
|
+
*
|
|
19
|
+
* Absent means the Host has no capability service, so every row reports
|
|
20
|
+
* `unknown` provenance and `semanticCoverage.source` stays `unknown`.
|
|
21
|
+
*/
|
|
22
|
+
resolveSource?: CallIndexSourceResolver;
|
|
23
|
+
}
|
|
24
|
+
export interface IndexScanOptions {
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
maxEvents?: number;
|
|
27
|
+
full?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* In-memory engine for N22. It is deliberately not mounted in the old Usage runtime.
|
|
31
|
+
* Scope is freshly resolved before AND after asynchronous service operations.
|
|
32
|
+
* Memory limits bound estimated retained index metadata, not backend decoding/RSS.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SessionCallIndex {
|
|
35
|
+
private readonly options;
|
|
36
|
+
private readonly scopes;
|
|
37
|
+
private lastScope;
|
|
38
|
+
private token;
|
|
39
|
+
private ledger;
|
|
40
|
+
private readonly published;
|
|
41
|
+
private readonly stages;
|
|
42
|
+
private readonly live;
|
|
43
|
+
private readonly observedThrough;
|
|
44
|
+
private readonly visible;
|
|
45
|
+
private readonly pending;
|
|
46
|
+
private readonly failures;
|
|
47
|
+
private readonly reasons;
|
|
48
|
+
private task;
|
|
49
|
+
private aborter;
|
|
50
|
+
private fairCursor;
|
|
51
|
+
private generation;
|
|
52
|
+
private censusGeneration;
|
|
53
|
+
private asOf;
|
|
54
|
+
private enumerated;
|
|
55
|
+
private enumerationCurrent;
|
|
56
|
+
private listedCount;
|
|
57
|
+
private phase;
|
|
58
|
+
private liveCount;
|
|
59
|
+
private disposed;
|
|
60
|
+
private readonly limits;
|
|
61
|
+
constructor(options: SessionCallIndexOptions);
|
|
62
|
+
private gap;
|
|
63
|
+
private syncScope;
|
|
64
|
+
private guard;
|
|
65
|
+
private reserve;
|
|
66
|
+
private discard;
|
|
67
|
+
/** Immediate projection keeps raw events out of the bounded live queue. */
|
|
68
|
+
observeLive(sessionId: string, raw: unknown, inheritedEventCount: number): boolean;
|
|
69
|
+
/** One active task, including concurrent callers. Cancellation is not a second task. */
|
|
70
|
+
start(options?: IndexScanOptions): Promise<ReturnType<SessionCallIndex['snapshot']>>;
|
|
71
|
+
/** Host observation failures are fixed codes, never exception messages or raw payloads. */
|
|
72
|
+
markGap(reason: 'live-projection-failed' | 'live-timer-failed'): void;
|
|
73
|
+
/** Publish observed metadata only; never enumerate/open historical storage here. */
|
|
74
|
+
flushLive(): ReturnType<SessionCallIndex['snapshot']>;
|
|
75
|
+
/** Cheap authorization/data stamp; resolving it also notices live backend replacement. */
|
|
76
|
+
stamp(): {
|
|
77
|
+
epoch?: number;
|
|
78
|
+
generation: number;
|
|
79
|
+
};
|
|
80
|
+
cancel(): void;
|
|
81
|
+
dispose(): void;
|
|
82
|
+
private stage;
|
|
83
|
+
private mergeLive;
|
|
84
|
+
private publish;
|
|
85
|
+
private run;
|
|
86
|
+
snapshot(includeRows?: boolean): {
|
|
87
|
+
corpus: "persisted-plus-observed-live";
|
|
88
|
+
scope: import("./call-index-scope.ts").CallIndexScopeDescription;
|
|
89
|
+
generation: number;
|
|
90
|
+
censusGeneration: number;
|
|
91
|
+
asOf: number | undefined;
|
|
92
|
+
phase: "cancelled" | "complete" | "failed" | "running" | "idle";
|
|
93
|
+
coverage: "complete" | "partial" | "unknown";
|
|
94
|
+
eventCoverage: "complete" | "partial" | "unknown";
|
|
95
|
+
enumerationCoverage: "complete" | "partial" | "unknown";
|
|
96
|
+
semanticCoverage: {
|
|
97
|
+
source: "unknown" | "verified";
|
|
98
|
+
ptc: "unknown";
|
|
99
|
+
skillExecution: "unavailable";
|
|
100
|
+
denied: "unavailable";
|
|
101
|
+
};
|
|
102
|
+
listedSessions: number;
|
|
103
|
+
visibleSessions: number;
|
|
104
|
+
completedSessions: number;
|
|
105
|
+
pendingSessions: number;
|
|
106
|
+
failedSessions: number;
|
|
107
|
+
pendingLive: number;
|
|
108
|
+
declaredEvents: number;
|
|
109
|
+
readEvents: number;
|
|
110
|
+
estimatedBytes: number;
|
|
111
|
+
reasons: string[];
|
|
112
|
+
sessions: {
|
|
113
|
+
revision: string;
|
|
114
|
+
cut: number;
|
|
115
|
+
coverage: "complete" | "partial";
|
|
116
|
+
stale: boolean;
|
|
117
|
+
reasons: string[];
|
|
118
|
+
cwd?: string | undefined;
|
|
119
|
+
sessionId: string;
|
|
120
|
+
}[];
|
|
121
|
+
rows: {
|
|
122
|
+
sessionId: string;
|
|
123
|
+
callSeq: number;
|
|
124
|
+
callId: string;
|
|
125
|
+
toolName: string;
|
|
126
|
+
turn?: number;
|
|
127
|
+
step?: number;
|
|
128
|
+
startedAt: number;
|
|
129
|
+
endedAt?: number;
|
|
130
|
+
resultSeq?: number;
|
|
131
|
+
durationMs?: number;
|
|
132
|
+
outcome: "success" | "error" | "cancelled" | "unresolved" | "unknown" | "running";
|
|
133
|
+
inherited: boolean;
|
|
134
|
+
sourceKind: import("./call-index-wire.ts").CallIndexSourceKind;
|
|
135
|
+
layer: "unknown";
|
|
136
|
+
}[];
|
|
137
|
+
totals: {
|
|
138
|
+
calls: number;
|
|
139
|
+
succeeded: number;
|
|
140
|
+
failed: number;
|
|
141
|
+
unresolved: number;
|
|
142
|
+
unknown: number;
|
|
143
|
+
cancelled: number;
|
|
144
|
+
running: number;
|
|
145
|
+
inherited: number;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=session-index.d.ts.map
|
|
@@ -0,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