@namzu/sdk 28.0.0 → 30.0.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/CHANGELOG.md +129 -0
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +0 -1
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +2 -4
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/config/runtime.d.ts +8 -8
- package/dist/contracts/a2a.d.ts +10 -10
- package/dist/contracts/schemas.d.ts +12 -12
- package/dist/manager/index.d.ts +2 -2
- package/dist/manager/index.d.ts.map +1 -1
- package/dist/manager/index.js +2 -2
- package/dist/manager/index.js.map +1 -1
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +10 -12
- package/dist/plugin/loader.js.map +1 -1
- package/dist/public-runtime.d.ts +21 -9
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +21 -9
- package/dist/public-runtime.js.map +1 -1
- package/dist/runtime/query/index.d.ts +0 -16
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +3 -10
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/session/handoff/broadcast.d.ts +6 -2
- package/dist/session/handoff/broadcast.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.js +1 -2
- package/dist/session/handoff/broadcast.js.map +1 -1
- package/dist/session/handoff/index.d.ts +1 -1
- package/dist/session/handoff/index.d.ts.map +1 -1
- package/dist/session/handoff/index.js +1 -1
- package/dist/session/handoff/index.js.map +1 -1
- package/dist/session/handoff/single.d.ts +7 -3
- package/dist/session/handoff/single.d.ts.map +1 -1
- package/dist/session/handoff/single.js +1 -7
- package/dist/session/handoff/single.js.map +1 -1
- package/dist/session/migration/id-prefix.d.ts +0 -11
- package/dist/session/migration/id-prefix.d.ts.map +1 -1
- package/dist/session/migration/id-prefix.js +0 -11
- package/dist/session/migration/id-prefix.js.map +1 -1
- package/dist/session/migration/index.d.ts +2 -2
- package/dist/session/migration/index.d.ts.map +1 -1
- package/dist/session/migration/index.js +2 -2
- package/dist/session/migration/index.js.map +1 -1
- package/dist/session/retention/archive.d.ts.map +1 -1
- package/dist/session/retention/archive.js +4 -16
- package/dist/session/retention/archive.js.map +1 -1
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +10 -12
- package/dist/skills/loader.js.map +1 -1
- package/dist/store/topic/memory.d.ts +4 -4
- package/dist/store/topic/memory.js +4 -4
- package/dist/tools/builtins/computer-use.d.ts +8 -8
- package/dist/types/agent/reactive.d.ts +0 -5
- package/dist/types/agent/reactive.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +0 -10
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/agent/supervisor.d.ts +0 -10
- package/dist/types/agent/supervisor.d.ts.map +1 -1
- package/dist/types/authorization/index.d.ts +24 -285
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +0 -4
- package/dist/types/authorization/index.js.map +1 -1
- package/dist/types/common/index.d.ts +0 -8
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/ids/index.d.ts +0 -15
- package/dist/types/ids/index.d.ts.map +1 -1
- package/dist/types/ids/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +6 -6
- package/dist/types/run/checkpoint-store.d.ts +0 -6
- package/dist/types/run/checkpoint-store.d.ts.map +1 -1
- package/dist/types/session/ids.d.ts +1 -3
- package/dist/types/session/ids.d.ts.map +1 -1
- package/dist/types/session/index.d.ts +1 -3
- package/dist/types/session/index.d.ts.map +1 -1
- package/dist/types/session/sub-session.d.ts +11 -22
- package/dist/types/session/sub-session.d.ts.map +1 -1
- package/dist/utils/id.d.ts +0 -8
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +0 -8
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/log/create-logger.d.ts +3 -3
- package/dist/utils/log/create-logger.d.ts.map +1 -1
- package/dist/utils/log/create-logger.js +10 -8
- package/dist/utils/log/create-logger.js.map +1 -1
- package/dist/utils/log/process-sink.d.ts +7 -4
- package/dist/utils/log/process-sink.d.ts.map +1 -1
- package/dist/utils/log/process-sink.js +19 -13
- package/dist/utils/log/process-sink.js.map +1 -1
- package/dist/utils/log/types.d.ts +12 -7
- package/dist/utils/log/types.d.ts.map +1 -1
- package/dist/utils/log/types.js +6 -6
- package/dist/utils/log/types.js.map +1 -1
- package/dist/utils/logger.d.ts +15 -35
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +18 -136
- package/dist/utils/logger.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/ReactiveAgent.ts +0 -1
- package/src/agents/SupervisorAgent.ts +2 -9
- package/src/manager/index.ts +0 -1
- package/src/plugin/loader.ts +10 -12
- package/src/public-runtime.ts +14 -7
- package/src/runtime/query/index.ts +4 -44
- package/src/session/handoff/broadcast.ts +7 -3
- package/src/session/handoff/index.ts +1 -1
- package/src/session/handoff/single.ts +8 -9
- package/src/session/migration/id-prefix.ts +0 -13
- package/src/session/migration/index.ts +0 -2
- package/src/session/retention/archive.ts +4 -17
- package/src/skills/loader.ts +10 -12
- package/src/store/topic/memory.ts +4 -4
- package/src/types/agent/reactive.ts +0 -5
- package/src/types/agent/scheduler.ts +0 -11
- package/src/types/agent/supervisor.ts +0 -11
- package/src/types/authorization/index.ts +0 -10
- package/src/types/common/index.ts +0 -9
- package/src/types/ids/index.ts +0 -15
- package/src/types/run/checkpoint-store.ts +0 -7
- package/src/types/session/ids.ts +0 -2
- package/src/types/session/index.ts +0 -2
- package/src/types/session/sub-session.ts +11 -23
- package/src/utils/id.ts +0 -9
- package/src/utils/log/create-logger.ts +10 -8
- package/src/utils/log/process-sink.ts +19 -13
- package/src/utils/log/types.ts +18 -13
- package/src/utils/logger.ts +18 -159
- package/dist/deprecated-aliases.d.ts +0 -80
- package/dist/deprecated-aliases.d.ts.map +0 -1
- package/dist/deprecated-aliases.js +0 -60
- package/dist/deprecated-aliases.js.map +0 -1
- package/src/deprecated-aliases.ts +0 -86
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/log/types.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/log/types.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,wEAAwE;AACxE,8EAA8E;AAC9E,8DAA8D;AAyF9D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAA"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -9,28 +9,17 @@ export interface Logger {
|
|
|
9
9
|
child(context: LogContext): Logger;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
* here rather than inlined at each call site so a boundary that threads a
|
|
24
|
-
* host-supplied logger can stay entirely free of `getRootLogger()` itself.
|
|
25
|
-
* `RunContextFactory.buildLogger` was the first caller (LOG-07); LOG-10
|
|
26
|
-
* moved every remaining constructor across `packages/sdk/src` onto this
|
|
27
|
-
* same seam, so this function's own fallback is now the ONLY place in the
|
|
28
|
-
* package that reads the process-wide global outside a host's direct call
|
|
29
|
-
* to `getRootLogger()` itself. `getRootLoggerCount` in
|
|
30
|
-
* `scripts/log-standard.json` measures exactly that: it cannot reach zero
|
|
31
|
-
* while an optional, non-breaking fallback exists at all — removing the
|
|
32
|
-
* fallback (flipping the default to `NOOP_LOGGER`) is LOG-20's major, not
|
|
33
|
-
* this seam's.
|
|
12
|
+
* A logger that discards, when nobody supplied one.
|
|
13
|
+
*
|
|
14
|
+
* The fallback used to be a process-wide global, so a construction with no
|
|
15
|
+
* logger silently wrote to stderr — from a library, on a stream the host may
|
|
16
|
+
* be using for its own protocol. LOG-20 flipped it: a component given no
|
|
17
|
+
* logger produces nothing, and the drop is counted where `getLogCounters()`
|
|
18
|
+
* can read it.
|
|
19
|
+
*
|
|
20
|
+
* The seam stays rather than being inlined at each call site, so every
|
|
21
|
+
* constructor in the package expresses "logger optional" the same way and one
|
|
22
|
+
* line decides what optional means.
|
|
34
23
|
*/
|
|
35
24
|
export declare function resolveLogger(logger: Logger | undefined): Logger;
|
|
36
25
|
/**
|
|
@@ -38,21 +27,12 @@ export declare function resolveLogger(logger: Logger | undefined): Logger;
|
|
|
38
27
|
* when no host has claimed the process's log destination.
|
|
39
28
|
*
|
|
40
29
|
* `undefined` is the honest answer for that case, not a zeroed set. With no
|
|
41
|
-
* sink installed
|
|
42
|
-
*
|
|
43
|
-
* nothing
|
|
44
|
-
*
|
|
45
|
-
* never measured" and happens to be the claim a reader most wants to trust.
|
|
30
|
+
* sink installed there is no pipeline, and therefore no redaction pass, no
|
|
31
|
+
* size caps and nothing to count -- reporting five zeros would read as
|
|
32
|
+
* "nothing was dropped, nothing was redacted", a stronger claim than "this
|
|
33
|
+
* was never measured" and the one a reader most wants to trust.
|
|
46
34
|
* `namzu doctor`'s `logging.pipeline` check turns the absence into its own
|
|
47
35
|
* row rather than into a clean bill of health.
|
|
48
36
|
*/
|
|
49
37
|
export declare function getLogCounters(): LogSinkCounters | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated See `getRootLogger`'s deprecation note. `installProcessSink`
|
|
52
|
-
* is the strictly more capable replacement — it picks a destination, not
|
|
53
|
-
* only a threshold. Unchanged behaviour; this JSDoc is the only edit.
|
|
54
|
-
*/
|
|
55
|
-
export declare function configureLogger(options: {
|
|
56
|
-
level?: LogLevel;
|
|
57
|
-
}): void;
|
|
58
38
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AAErE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEhD,MAAM,WAAW,MAAM;IACtB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC9C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC9C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC/C,KAAK,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAA;CAClC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAEhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,IAAI,eAAe,GAAG,SAAS,CAE5D"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,152 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getProcessSink
|
|
3
|
-
import { SCOPE_ATTRIBUTE } from './log/types.js';
|
|
4
|
-
const LOG_LEVELS = {
|
|
5
|
-
debug: 0,
|
|
6
|
-
info: 1,
|
|
7
|
-
warn: 2,
|
|
8
|
-
error: 3,
|
|
9
|
-
// `silent` sits above every emit level so the `level < minLevelNum`
|
|
10
|
-
// guard in `log()` always short-circuits when configured. Used by
|
|
11
|
-
// test harnesses to suppress unmocked `getRootLogger()` stderr
|
|
12
|
-
// writes; see packages/sdk/src/test-setup.ts.
|
|
13
|
-
silent: 4,
|
|
14
|
-
};
|
|
15
|
-
function createLoggerImpl(name, minLevel, parentContext) {
|
|
16
|
-
const minLevelNum = LOG_LEVELS[minLevel];
|
|
17
|
-
function log(level, message, data) {
|
|
18
|
-
if (LOG_LEVELS[level] < minLevelNum)
|
|
19
|
-
return;
|
|
20
|
-
const timestamp = new Date().toISOString();
|
|
21
|
-
const prefix = `[${timestamp}] [${level.toUpperCase()}] [${name}]`;
|
|
22
|
-
const merged = { ...parentContext, ...data };
|
|
23
|
-
const hasContext = Object.keys(merged).length > 0;
|
|
24
|
-
if (hasContext) {
|
|
25
|
-
process.stderr.write(`${prefix} ${message} ${JSON.stringify(merged)}\n`);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
process.stderr.write(`${prefix} ${message}\n`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function child(context) {
|
|
32
|
-
const { [SCOPE_ATTRIBUTE]: scopeOverride, ...rest } = context;
|
|
33
|
-
return createLoggerImpl(typeof scopeOverride === 'string' ? scopeOverride : name, minLevel, {
|
|
34
|
-
...parentContext,
|
|
35
|
-
...rest,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
debug: (msg, data) => log('debug', msg, data),
|
|
40
|
-
info: (msg, data) => log('info', msg, data),
|
|
41
|
-
warn: (msg, data) => log('warn', msg, data),
|
|
42
|
-
error: (msg, data) => log('error', msg, data),
|
|
43
|
-
child,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
let _rootLogger = null;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Prefer `installProcessSink` (own the process's log
|
|
49
|
-
* destination) or `createLogger` (build a logger scoped to a run, tenant or
|
|
50
|
-
* subsystem) from `packages/sdk/src/utils/log/`. `getRootLogger` and
|
|
51
|
-
* `configureLogger` read and write one process-wide global with no
|
|
52
|
-
* destination lever beyond a level threshold — the reason every CLI entry
|
|
53
|
-
* point historically had only one option: switch it off entirely.
|
|
54
|
-
* Unchanged behaviour; this JSDoc is the only edit.
|
|
55
|
-
*/
|
|
56
|
-
export function getRootLogger() {
|
|
57
|
-
// A process sink, when one is installed, wins over both the cached logger
|
|
58
|
-
// and the stderr default. Resolved per CALL rather than cached, for the
|
|
59
|
-
// same reason the new pipeline reads its level per record: a logger handed
|
|
60
|
-
// out before `installProcessSink` ran would otherwise keep writing to
|
|
61
|
-
// stderr forever, which is the exact shape of the three frozen loaders
|
|
62
|
-
// this migration just fixed.
|
|
63
|
-
//
|
|
64
|
-
// This bridge is what lets the ~39 existing `getRootLogger()` call sites
|
|
65
|
-
// reach a host's sink without being rewritten in one commit. They keep the
|
|
66
|
-
// old interface and gain the new destination.
|
|
67
|
-
const installed = getProcessSink();
|
|
68
|
-
if (installed)
|
|
69
|
-
return fromSink(installed.sink, installed.level);
|
|
70
|
-
if (!_rootLogger) {
|
|
71
|
-
_rootLogger = createLoggerImpl('namzu', 'info', {});
|
|
72
|
-
}
|
|
73
|
-
return _rootLogger;
|
|
74
|
-
}
|
|
1
|
+
import { NOOP_LOGGER } from './log/create-logger.js';
|
|
2
|
+
import { getProcessSink } from './log/process-sink.js';
|
|
75
3
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* this seam's.
|
|
4
|
+
* A logger that discards, when nobody supplied one.
|
|
5
|
+
*
|
|
6
|
+
* The fallback used to be a process-wide global, so a construction with no
|
|
7
|
+
* logger silently wrote to stderr — from a library, on a stream the host may
|
|
8
|
+
* be using for its own protocol. LOG-20 flipped it: a component given no
|
|
9
|
+
* logger produces nothing, and the drop is counted where `getLogCounters()`
|
|
10
|
+
* can read it.
|
|
11
|
+
*
|
|
12
|
+
* The seam stays rather than being inlined at each call site, so every
|
|
13
|
+
* constructor in the package expresses "logger optional" the same way and one
|
|
14
|
+
* line decides what optional means.
|
|
88
15
|
*/
|
|
89
16
|
export function resolveLogger(logger) {
|
|
90
|
-
return logger ??
|
|
17
|
+
return logger ?? NOOP_LOGGER;
|
|
91
18
|
}
|
|
92
19
|
/**
|
|
93
20
|
* What the record pipeline did to the records it was given, or `undefined`
|
|
94
21
|
* when no host has claimed the process's log destination.
|
|
95
22
|
*
|
|
96
23
|
* `undefined` is the honest answer for that case, not a zeroed set. With no
|
|
97
|
-
* sink installed
|
|
98
|
-
*
|
|
99
|
-
* nothing
|
|
100
|
-
*
|
|
101
|
-
* never measured" and happens to be the claim a reader most wants to trust.
|
|
24
|
+
* sink installed there is no pipeline, and therefore no redaction pass, no
|
|
25
|
+
* size caps and nothing to count -- reporting five zeros would read as
|
|
26
|
+
* "nothing was dropped, nothing was redacted", a stronger claim than "this
|
|
27
|
+
* was never measured" and the one a reader most wants to trust.
|
|
102
28
|
* `namzu doctor`'s `logging.pipeline` check turns the absence into its own
|
|
103
29
|
* row rather than into a clean bill of health.
|
|
104
30
|
*/
|
|
105
31
|
export function getLogCounters() {
|
|
106
32
|
return getProcessSink()?.counters;
|
|
107
33
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Adapts the record pipeline back to the legacy `Logger` shape. `scope`
|
|
110
|
-
* threads through recursive `child()` calls the same way `bound` does.
|
|
111
|
-
* Previously fixed at `'namzu'` on every recursive call regardless of what
|
|
112
|
-
* a caller bound — meaning every `getRootLogger()`-derived child logger
|
|
113
|
-
* (the majority of call sites in this package) reported the SAME
|
|
114
|
-
* `scope.name` no matter what `SCOPE_ATTRIBUTE` it was given. This is the
|
|
115
|
-
* single highest-leverage line in the LOG-09 migration: see the direct
|
|
116
|
-
* regression test in `runtime/query/__tests__/context.test.ts` and
|
|
117
|
-
* `utils/__tests__/log-scope-attribute.test.ts`.
|
|
118
|
-
*/
|
|
119
|
-
function fromSink(sink, level, bound = {}, scope = 'namzu') {
|
|
120
|
-
// The process's counter set, not a fresh one. `getRootLogger` resolves
|
|
121
|
-
// PER CALL and lands here every time, so a logger built with its own
|
|
122
|
-
// counters would throw the totals away between one log line and the
|
|
123
|
-
// next -- which is what made `LogSinkCounters` unreadable by anything.
|
|
124
|
-
const created = createLogger({
|
|
125
|
-
sink,
|
|
126
|
-
level: { current: level },
|
|
127
|
-
resource: { 'service.name': 'namzu' },
|
|
128
|
-
scope,
|
|
129
|
-
}, getProcessSinkCounters());
|
|
130
|
-
const write = (severity) => (message, data) => {
|
|
131
|
-
created[severity](message, { ...bound, ...data });
|
|
132
|
-
};
|
|
133
|
-
return {
|
|
134
|
-
debug: write('debug'),
|
|
135
|
-
info: write('info'),
|
|
136
|
-
warn: write('warn'),
|
|
137
|
-
error: write('error'),
|
|
138
|
-
child: (context) => {
|
|
139
|
-
const { [SCOPE_ATTRIBUTE]: scopeOverride, ...rest } = context;
|
|
140
|
-
return fromSink(sink, level, { ...bound, ...rest }, typeof scopeOverride === 'string' ? scopeOverride : scope);
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @deprecated See `getRootLogger`'s deprecation note. `installProcessSink`
|
|
146
|
-
* is the strictly more capable replacement — it picks a destination, not
|
|
147
|
-
* only a threshold. Unchanged behaviour; this JSDoc is the only edit.
|
|
148
|
-
*/
|
|
149
|
-
export function configureLogger(options) {
|
|
150
|
-
_rootLogger = createLoggerImpl('namzu', options.level ?? 'info', {});
|
|
151
|
-
}
|
|
152
34
|
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAetD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,MAA0B;IACvD,OAAO,MAAM,IAAI,WAAW,CAAA;AAC7B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc;IAC7B,OAAO,cAAc,EAAE,EAAE,QAAQ,CAAA;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -71,7 +71,6 @@ export class ReactiveAgent extends AbstractAgent<ReactiveAgentConfig, ReactiveAg
|
|
|
71
71
|
basePrompt: config.basePrompt,
|
|
72
72
|
provider: config.provider,
|
|
73
73
|
tools: config.tools,
|
|
74
|
-
...(config.verificationGate ? { verificationGate: config.verificationGate } : {}),
|
|
75
74
|
...(config.authorizationGate ? { authorizationGate: config.authorizationGate } : {}),
|
|
76
75
|
...(config.sandboxProvider ? { sandboxProvider: config.sandboxProvider } : {}),
|
|
77
76
|
// Working-memory / compaction seam (optional; absent => unchanged run path).
|
|
@@ -20,7 +20,6 @@ import type { RunEventListener } from '../types/run/index.js'
|
|
|
20
20
|
import type { ActorRef } from '../types/session/actor.js'
|
|
21
21
|
import { ZERO_COST } from '../utils/cost.js'
|
|
22
22
|
import type { Logger } from '../utils/logger.js'
|
|
23
|
-
import { pickRenamed } from '../utils/renamed-field.js'
|
|
24
23
|
import { AbstractAgent } from './AbstractAgent.js'
|
|
25
24
|
|
|
26
25
|
/**
|
|
@@ -131,12 +130,7 @@ export class SupervisorAgent extends AbstractAgent<SupervisorAgentConfig, Superv
|
|
|
131
130
|
// instead, a host that set only `scheduler` would get a working one
|
|
132
131
|
// on one path and `undefined` on another — a half-migration that
|
|
133
132
|
// fails silently, which is worse than not renaming the field.
|
|
134
|
-
const configuredScheduler =
|
|
135
|
-
'gateway',
|
|
136
|
-
config.gateway,
|
|
137
|
-
'scheduler',
|
|
138
|
-
config.scheduler,
|
|
139
|
-
)
|
|
133
|
+
const configuredScheduler = config.scheduler
|
|
140
134
|
|
|
141
135
|
let gateway: TaskScheduler
|
|
142
136
|
if (configuredScheduler) {
|
|
@@ -349,7 +343,7 @@ export class SupervisorAgent extends AbstractAgent<SupervisorAgentConfig, Superv
|
|
|
349
343
|
taskStore: input.taskStore,
|
|
350
344
|
runtimeToolOverrides: input.runtimeToolOverrides,
|
|
351
345
|
runtimeContext: input.runtimeContext,
|
|
352
|
-
|
|
346
|
+
taskScheduler: gateway,
|
|
353
347
|
completionInbox,
|
|
354
348
|
advisory: config.advisory,
|
|
355
349
|
invocationState: childInvocationState,
|
|
@@ -365,7 +359,6 @@ export class SupervisorAgent extends AbstractAgent<SupervisorAgentConfig, Superv
|
|
|
365
359
|
// corrected for twice.
|
|
366
360
|
...(config.steering ? { steering: config.steering } : {}),
|
|
367
361
|
...(config.inboundMessages ? { inboundMessages: config.inboundMessages } : {}),
|
|
368
|
-
...(config.verificationGate ? { verificationGate: config.verificationGate } : {}),
|
|
369
362
|
...(config.authorizationGate ? { authorizationGate: config.authorizationGate } : {}),
|
|
370
363
|
// The one hop between the config and the tool. `drainQuery`
|
|
371
364
|
// registers `structured_output` from this and the loop
|
package/src/manager/index.ts
CHANGED
|
@@ -19,7 +19,6 @@ export type { PlanEvent, PlanEventListener, PlanApprovalHandler } from './plan/l
|
|
|
19
19
|
export {
|
|
20
20
|
TopicManager,
|
|
21
21
|
/** @deprecated Use {@link TopicManager}. Literal identity re-export -- instanceof/=== still hold. Removal is NZ-TOPIC-05. */
|
|
22
|
-
TopicManager as ThreadManager,
|
|
23
22
|
} from './topic/lifecycle.js'
|
|
24
23
|
export type { TopicManagerDeps } from './topic/lifecycle.js'
|
|
25
24
|
|
package/src/plugin/loader.ts
CHANGED
|
@@ -15,18 +15,16 @@ import { type Logger, resolveLogger } from '../utils/logger.js'
|
|
|
15
15
|
* Returns an array of absolute paths to plugin directories.
|
|
16
16
|
*/
|
|
17
17
|
export async function discoverPlugins(parentDir: string, log?: Logger): Promise<string[]> {
|
|
18
|
-
// Resolved here, not at module scope
|
|
19
|
-
// `
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
// `log`, when a caller has one, wins over the process default — LOG-10:
|
|
29
|
-
// this was the module's own remaining getRootLogger() call site.
|
|
18
|
+
// Resolved here, not at module scope, and the reason outlived the defect
|
|
19
|
+
// it was written for. A module-scope `child(...)` of a process-wide logger
|
|
20
|
+
// ran once at IMPORT time and baked that moment's level in forever, which
|
|
21
|
+
// no later host call could undo. LOG-20 removed the process-wide logger
|
|
22
|
+
// altogether, so that particular trap is gone — and per-call resolution
|
|
23
|
+
// matters more now, not less: the logger this function uses comes from its
|
|
24
|
+
// own `log` parameter, and anything resolved at module scope could not see
|
|
25
|
+
// it. Without a `log`, discovery emits nothing (`resolveLogger` is
|
|
26
|
+
// `NOOP_LOGGER`), which is the deliberate default rather than a fallback
|
|
27
|
+
// to somebody else's stream.
|
|
30
28
|
const logger = resolveLogger(log).child({ [SCOPE_ATTRIBUTE]: 'plugin/loader' })
|
|
31
29
|
const dirs: string[] = []
|
|
32
30
|
|
package/src/public-runtime.ts
CHANGED
|
@@ -81,7 +81,20 @@ export {
|
|
|
81
81
|
// model list, so that check lives in the driver and needs this.
|
|
82
82
|
export { normaliseModelId, resolveModelPricing, VENDOR_RATES } from './pricing/index.js'
|
|
83
83
|
export { toErrorMessage } from './utils/error.js'
|
|
84
|
-
export {
|
|
84
|
+
export { getLogCounters, Logger } from './utils/logger.js'
|
|
85
|
+
/**
|
|
86
|
+
* The process sink's own counter set, for a host that installs a sink and
|
|
87
|
+
* then builds its own logger from it.
|
|
88
|
+
*
|
|
89
|
+
* Exported by LOG-20 out of necessity rather than design. Removing
|
|
90
|
+
* `getRootLogger` removed `fromSink`, which was the only thing passing this
|
|
91
|
+
* set into a `createLogger`. Without it every host-written record counts into
|
|
92
|
+
* a private set, `getLogCounters()` reports a permanently zeroed one, and
|
|
93
|
+
* `namzu doctor`'s `logging.pipeline` check reads health it never measured —
|
|
94
|
+
* a check that cannot fail, introduced by the removal that was supposed to
|
|
95
|
+
* end them.
|
|
96
|
+
*/
|
|
97
|
+
export { getProcessSinkCounters } from './utils/log/process-sink.js'
|
|
85
98
|
|
|
86
99
|
// The LogSink seam — additive. `Logger`/`getRootLogger`/`configureLogger`
|
|
87
100
|
// above are unchanged; this is the new seam that replaces them going
|
|
@@ -458,13 +471,11 @@ export {
|
|
|
458
471
|
* that release never reached npm, so this major is the first one a consumer
|
|
459
472
|
* can actually see the warning in.
|
|
460
473
|
*/
|
|
461
|
-
ThreadManager,
|
|
462
474
|
} from './manager/index.js'
|
|
463
475
|
|
|
464
476
|
export {
|
|
465
477
|
InMemoryTopicStore,
|
|
466
478
|
/** @deprecated Use {@link InMemoryTopicStore}. Removal is NZ-TOPIC-05. */
|
|
467
|
-
InMemoryTopicStore as InMemoryThreadStore,
|
|
468
479
|
} from './store/topic/memory.js'
|
|
469
480
|
|
|
470
481
|
export { LocalTaskScheduler } from './scheduler/local.js'
|
|
@@ -766,7 +777,6 @@ export { collectChatCompletion } from './provider/collect-chat-completion.js'
|
|
|
766
777
|
// The file explains why each is a `const`+`type` pair rather than a
|
|
767
778
|
// re-export alias; the short version is that a re-export cannot carry the
|
|
768
779
|
// `@deprecated` tag, and the tag is what the public-surface gate reads.
|
|
769
|
-
export * from './deprecated-aliases.js'
|
|
770
780
|
|
|
771
781
|
export {
|
|
772
782
|
wrapCredentialProviderWithProbes,
|
|
@@ -800,7 +810,6 @@ export {
|
|
|
800
810
|
HandoffLockRejected,
|
|
801
811
|
HandoffVersionConflict,
|
|
802
812
|
NOOP_HANDOFF_SINK,
|
|
803
|
-
NOOP_RUN_STATUS_RESOLVER,
|
|
804
813
|
} from './session/handoff/index.js'
|
|
805
814
|
|
|
806
815
|
export {
|
|
@@ -819,7 +828,6 @@ export {
|
|
|
819
828
|
export {
|
|
820
829
|
acceptLegacyContainerId,
|
|
821
830
|
/** @deprecated Use {@link acceptLegacyContainerId}. Removal is NZ-TOPIC-05. */
|
|
822
|
-
acceptLegacyThreadId,
|
|
823
831
|
acquireMigrationLock,
|
|
824
832
|
DefaultFilesystemMigrator,
|
|
825
833
|
FilesystemMigrationError,
|
|
@@ -834,7 +842,6 @@ export {
|
|
|
834
842
|
readMarker,
|
|
835
843
|
rejectLegacyContainerPrefix,
|
|
836
844
|
/** @deprecated Use {@link rejectLegacyContainerPrefix}. Removal is NZ-TOPIC-05. */
|
|
837
|
-
rejectLegacyPrefix,
|
|
838
845
|
releaseMigrationLock,
|
|
839
846
|
StalePrefixError,
|
|
840
847
|
WINDOW_OPEN,
|
|
@@ -96,7 +96,6 @@ import { generateRunId } from '../../utils/id.js'
|
|
|
96
96
|
import { errorAttributes } from '../../utils/log/exception.js'
|
|
97
97
|
import { EVENT_NAME_ATTRIBUTE } from '../../utils/log/types.js'
|
|
98
98
|
import type { Logger } from '../../utils/logger.js'
|
|
99
|
-
import { pickRenamed } from '../../utils/renamed-field.js'
|
|
100
99
|
import type { BackgroundJobRegistry } from '../jobs/registry.js'
|
|
101
100
|
import { AUTO_APPROVE_POLICY_NAME, createRunApprovalPolicy } from './approval-policy.js'
|
|
102
101
|
import { CheckpointManager } from './checkpoint.js'
|
|
@@ -593,13 +592,6 @@ export interface QueryParams {
|
|
|
593
592
|
|
|
594
593
|
depth?: number
|
|
595
594
|
|
|
596
|
-
/**
|
|
597
|
-
* @deprecated Renamed to {@link QueryParams.promptCache}. Removed in the
|
|
598
|
-
* next major. Setting both to different instances throws rather than
|
|
599
|
-
* picking one.
|
|
600
|
-
*/
|
|
601
|
-
contextCache?: PromptCache
|
|
602
|
-
|
|
603
595
|
promptCache?: PromptCache
|
|
604
596
|
|
|
605
597
|
contextLevel?: AgentContextLevel
|
|
@@ -612,12 +604,6 @@ export interface QueryParams {
|
|
|
612
604
|
|
|
613
605
|
runtimeContext?: AgentRuntimeContext
|
|
614
606
|
|
|
615
|
-
/**
|
|
616
|
-
* @deprecated Renamed to {@link QueryParams.taskScheduler}. Removed in
|
|
617
|
-
* the next major. Setting both to different instances throws.
|
|
618
|
-
*/
|
|
619
|
-
taskGateway?: import('../../types/agent/scheduler.js').TaskScheduler
|
|
620
|
-
|
|
621
607
|
taskScheduler?: import('../../types/agent/scheduler.js').TaskScheduler
|
|
622
608
|
|
|
623
609
|
/**
|
|
@@ -708,12 +694,6 @@ export interface QueryParams {
|
|
|
708
694
|
|
|
709
695
|
agentBus?: import('../../bus/index.js').AgentBus
|
|
710
696
|
|
|
711
|
-
/**
|
|
712
|
-
* @deprecated Renamed to `authorizationGate`. Removed in the next major.
|
|
713
|
-
* Setting both to different configs throws.
|
|
714
|
-
*/
|
|
715
|
-
verificationGate?: AuthorizationGateConfig
|
|
716
|
-
|
|
717
697
|
authorizationGate?: AuthorizationGateConfig
|
|
718
698
|
|
|
719
699
|
pluginManager?: import('../../plugin/lifecycle.js').PluginLifecycleManager
|
|
@@ -851,18 +831,8 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
851
831
|
// and refusing it here costs them nothing; refusing it at the read site
|
|
852
832
|
// deep in the loop turns the same bug into a mid-run failure, after a
|
|
853
833
|
// provider call has been paid for and a partial transcript written.
|
|
854
|
-
const promptCache =
|
|
855
|
-
|
|
856
|
-
params.contextCache,
|
|
857
|
-
'promptCache',
|
|
858
|
-
params.promptCache,
|
|
859
|
-
)
|
|
860
|
-
const taskScheduler = pickRenamed(
|
|
861
|
-
'taskGateway',
|
|
862
|
-
params.taskGateway,
|
|
863
|
-
'taskScheduler',
|
|
864
|
-
params.taskScheduler,
|
|
865
|
-
)
|
|
834
|
+
const promptCache = params.promptCache
|
|
835
|
+
const taskScheduler = params.taskScheduler
|
|
866
836
|
|
|
867
837
|
// The run's one correlated logger, built before anything below needs
|
|
868
838
|
// one — the migration check, the retry/fallback wrappers and `ctx`
|
|
@@ -1443,18 +1413,8 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1443
1413
|
}
|
|
1444
1414
|
}
|
|
1445
1415
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
// new name would get a gate on one path and none on another — which for
|
|
1449
|
-
// an AUTHORIZATION gate means a tool call permitted somewhere it should
|
|
1450
|
-
// have been refused. That is the failure this field's window has to not
|
|
1451
|
-
// have.
|
|
1452
|
-
const gateConfig = pickRenamed(
|
|
1453
|
-
'verificationGate',
|
|
1454
|
-
params.verificationGate,
|
|
1455
|
-
'authorizationGate',
|
|
1456
|
-
params.authorizationGate,
|
|
1457
|
-
)
|
|
1416
|
+
const gateConfig = params.authorizationGate
|
|
1417
|
+
|
|
1458
1418
|
const verificationGate = gateConfig?.enabled
|
|
1459
1419
|
? new AuthorizationGate(gateConfig, ctx.log)
|
|
1460
1420
|
: undefined
|
|
@@ -34,7 +34,7 @@ import type { WorkspaceBackendRegistry } from '../workspace/registry.js'
|
|
|
34
34
|
import type { HandoffAssignment, HandoffOutcome } from './assignment.js'
|
|
35
35
|
import type { CapacityValidator } from './capacity.js'
|
|
36
36
|
import type { HandoffEventSink } from './events.js'
|
|
37
|
-
import {
|
|
37
|
+
import type { RunStatusResolver } from './single.js'
|
|
38
38
|
import { HandoffLockRejected, HandoffVersionConflict } from './version.js'
|
|
39
39
|
|
|
40
40
|
export interface BroadcastHandoffDeps {
|
|
@@ -42,7 +42,11 @@ export interface BroadcastHandoffDeps {
|
|
|
42
42
|
workspaceRegistry: WorkspaceBackendRegistry
|
|
43
43
|
capacity: CapacityValidator
|
|
44
44
|
events: HandoffEventSink
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Required, for the reason `SingleHandoffDeps.runStatus` is: the default
|
|
47
|
+
* that used to stand in here reported every session unblocked.
|
|
48
|
+
*/
|
|
49
|
+
runStatus: RunStatusResolver
|
|
46
50
|
/**
|
|
47
51
|
* Gate every recipient-session creation on the Thread being `'open'`.
|
|
48
52
|
* Added in Phase 2.6; checked once per broadcast (all recipients share
|
|
@@ -183,7 +187,7 @@ export async function executeBroadcastHandoff(
|
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
// 5. Non-terminal Run fan-in (§5.1).
|
|
186
|
-
const runResolver = deps.runStatus
|
|
190
|
+
const runResolver = deps.runStatus
|
|
187
191
|
const blocking = await runResolver.blockingRun(source.id, tenantId)
|
|
188
192
|
if (blocking) {
|
|
189
193
|
throw new HandoffLockRejected({ sessionId: source.id, reason: blocking.reason })
|
|
@@ -22,7 +22,7 @@ export type {
|
|
|
22
22
|
HandoffUnlockedEvent,
|
|
23
23
|
} from './events.js'
|
|
24
24
|
|
|
25
|
-
export { executeSingleHandoff
|
|
25
|
+
export { executeSingleHandoff } from './single.js'
|
|
26
26
|
export type { RunStatusResolver, SingleHandoffDeps } from './single.js'
|
|
27
27
|
|
|
28
28
|
export { executeBroadcastHandoff } from './broadcast.js'
|
|
@@ -53,19 +53,18 @@ export interface RunStatusResolver {
|
|
|
53
53
|
): Promise<{ reason: 'active_run' | 'pending_hitl' | 'pending_subsession' } | null>
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/** Null resolver — treats every session as unblocked. Used by tests that do not exercise Run fan-in. */
|
|
57
|
-
export const NOOP_RUN_STATUS_RESOLVER: RunStatusResolver = {
|
|
58
|
-
async blockingRun(): Promise<null> {
|
|
59
|
-
return null
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
|
|
63
56
|
export interface SingleHandoffDeps {
|
|
64
57
|
store: SessionStore
|
|
65
58
|
workspaceRegistry: WorkspaceBackendRegistry
|
|
66
59
|
capacity: CapacityValidator
|
|
67
60
|
events: HandoffEventSink
|
|
68
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Required. A caller that genuinely wants no fan-in check supplies their
|
|
63
|
+
* own always-null resolver, deliberately — the default that used to sit
|
|
64
|
+
* here answered `null` for every session, which is a check that cannot
|
|
65
|
+
* fail dressed as a check that ran.
|
|
66
|
+
*/
|
|
67
|
+
runStatus: RunStatusResolver
|
|
69
68
|
/**
|
|
70
69
|
* Gate the recipient-session creation on the Topic being `'open'`.
|
|
71
70
|
* Added in Phase 2.6 to mirror spawn — a handoff into an archived
|
|
@@ -131,7 +130,7 @@ export async function executeSingleHandoff(
|
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
// 3. Non-terminal Run fan-in (§5.1).
|
|
134
|
-
const runResolver = deps.runStatus
|
|
133
|
+
const runResolver = deps.runStatus
|
|
135
134
|
const blocking = await runResolver.blockingRun(source.id, tenantId)
|
|
136
135
|
if (blocking) {
|
|
137
136
|
throw new HandoffLockRejected({
|
|
@@ -161,19 +161,6 @@ export function rejectLegacyContainerPrefix(id: string): void {
|
|
|
161
161
|
* must never call this — the whole point is one warning per distinct
|
|
162
162
|
* legacy id per process.
|
|
163
163
|
*/
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated Use {@link acceptLegacyContainerId}. Removal is NZ-TOPIC-05.
|
|
166
|
-
*
|
|
167
|
-
* The rename is the whole point of NZ-TOPIC-04 — `thd_` meant both the
|
|
168
|
-
* pre-0.2.0 top-level container this coerces and the live Topic layer, and
|
|
169
|
-
* only this function's NAME said which. The alias exists so the rename
|
|
170
|
-
* reaches a consumer as a warning first.
|
|
171
|
-
*/
|
|
172
|
-
export const acceptLegacyThreadId = acceptLegacyContainerId
|
|
173
|
-
|
|
174
|
-
/** @deprecated Use {@link rejectLegacyContainerPrefix}. Removal is NZ-TOPIC-05. */
|
|
175
|
-
export const rejectLegacyPrefix = rejectLegacyContainerPrefix
|
|
176
|
-
|
|
177
164
|
export function __resetSeenLegacyForTests(): void {
|
|
178
165
|
seenLegacy.clear()
|
|
179
166
|
}
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
export {
|
|
6
6
|
acceptLegacyContainerId,
|
|
7
7
|
/** @deprecated Use `acceptLegacyContainerId`. */
|
|
8
|
-
acceptLegacyThreadId,
|
|
9
8
|
rejectLegacyContainerPrefix,
|
|
10
9
|
/** @deprecated Use `rejectLegacyContainerPrefix`. */
|
|
11
|
-
rejectLegacyPrefix,
|
|
12
10
|
NOOP_MIGRATION_WARNING_SINK,
|
|
13
11
|
StalePrefixError,
|
|
14
12
|
WINDOW_OPEN,
|