@plurnk/plurnk-meta 1.22.0 → 1.23.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/SPEC.md CHANGED
@@ -93,6 +93,41 @@ Coordinated capabilities spanning families use explicit daemon-module
93
93
  composition ({§module-lifecycle}); a multi-kind manifest is not a parallel
94
94
  module mechanism.
95
95
 
96
+ ### §env-knob One environment reader
97
+
98
+ `Knob` reads a declared key from the system environment by name and nothing
99
+ else: `text`, `list`, `flag` (exactly `0` or `1`), `choice` (one of a
100
+ vocabulary), `percent` (`80%` is 0.8) and `integer(name, floor)` (a safe
101
+ integer of at least the floor, which bounds what the operator may say and is
102
+ never a value used in the operator's place). An unset key is a broken floor
103
+ and an invalid value is the operator's mistake; both crash naming the key.
104
+ No reader accepts a fallback: a signature that could carry one is a second
105
+ home for a choice. Every package reads its knobs through it, so the failure
106
+ wording has one home.
107
+
108
+ ### §error-detail-bound One diagnostic-preview bound
109
+
110
+ `new ErrorDetail(knob)` binds a package's model-facing diagnostic preview to
111
+ that package's `*_ERROR_DETAIL_LIMIT` knob, read through {§env-knob}:
112
+ `preview(value)` keeps at most that many characters of an error's message
113
+ (or a value's string form) and marks the cut with `...`. The bound is read at
114
+ each preview; an unset or invalid bound crashes by name at the first
115
+ diagnostic, never degrades into an unbounded one.
116
+
117
+ ### §plugin-manifest-read One package.json read
118
+
119
+ `Meta.readManifest(dir, kind)` is the one read of a package's family claim:
120
+ its `package.json`, parsed, with a `plurnk` object declaring exactly that
121
+ `kind` ({§plugin-family-kind}). It answers `null` for a missing or
122
+ malformed manifest, a non-object, no `plurnk` object, or another family —
123
+ none of those is a package of that family, and a scanner skips them without
124
+ evidence. The result carries the manifest path, the package name when
125
+ `name` is a non-empty string (otherwise `null`; what an unnamed package is
126
+ remains the family's decision), and the `plurnk` object untouched: family
127
+ fields are validated by the family, after the trust gate. A scanner that
128
+ passes an `AbortSignal` receives the abort; it is never masked as an
129
+ unreadable directory. No family reads a manifest any other way.
130
+
96
131
  ### §plugin-attribution Plugin-authored attribution tags
97
132
 
98
133
  | Surface | Contract |
@@ -129,3 +164,13 @@ does not crash discovery: the family result preserves its package identity as
129
164
  skipped evidence. The composed host decides how to present that evidence.
130
165
  Direct framework consumers receive the same safe load boundary and can choose
131
166
  their own presentation.
167
+
168
+ ## §observed-span Redaction-first spans
169
+
170
+ `observed(tracer, name, attributes, fn, options?)` and its synchronous twin wrap
171
+ one span around `fn` on the caller's tracer: attributes admit strings (capped at
172
+ 300 characters), numbers and booleans and drop everything else; a thrown error
173
+ marks the span `ERROR` and records only `error.type`, the error's class name,
174
+ never its message. Every instrumented package binds these to its own tracer
175
+ rather than declaring a second helper; prompts, payloads and arbitrary URLs never
176
+ reach a span through them.
@@ -0,0 +1,7 @@
1
+ export default class ErrorDetail {
2
+ #private;
3
+ constructor(knob: string);
4
+ limit(): number;
5
+ preview(value: unknown): string;
6
+ }
7
+ //# sourceMappingURL=ErrorDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorDetail.d.ts","sourceRoot":"","sources":["../src/ErrorDetail.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,WAAW;;IAG5B,YAAY,IAAI,EAAE,MAAM,EAEvB;IAED,KAAK,IAAI,MAAM,CAEd;IAED,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI9B;CACJ"}
@@ -0,0 +1,18 @@
1
+ import Knob from "./Knob.js";
2
+ // {§error-detail-bound} — a package's model-facing diagnostic detail is bounded by that package's
3
+ // knob, read through the one reader: an unset or invalid bound crashes by name, never degrades.
4
+ export default class ErrorDetail {
5
+ #knob;
6
+ constructor(knob) {
7
+ this.#knob = knob;
8
+ }
9
+ limit() {
10
+ return Knob.integer(this.#knob, 0);
11
+ }
12
+ preview(value) {
13
+ const text = value instanceof Error ? value.message : String(value);
14
+ const limit = this.limit();
15
+ return text.length > limit ? `${text.slice(0, limit)}...` : text;
16
+ }
17
+ }
18
+ //# sourceMappingURL=ErrorDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorDetail.js","sourceRoot":"","sources":["../src/ErrorDetail.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,kGAAkG;AAClG,gGAAgG;AAChG,MAAM,CAAC,OAAO,OAAO,WAAW;IACnB,KAAK,CAAS;IAEvB,YAAY,IAAY;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,KAAK;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,KAAc;QAClB,MAAM,IAAI,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,CAAC;CACJ"}
package/dist/Knob.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export default class Knob {
2
+ static text(name: string): string;
3
+ static list(name: string): string[];
4
+ static flag(name: string): boolean;
5
+ static choice<T extends string>(name: string, options: readonly T[]): T;
6
+ static percent(name: string): number;
7
+ static integer(name: string, floor: number): number;
8
+ }
9
+ //# sourceMappingURL=Knob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Knob.d.ts","sourceRoot":"","sources":["../src/Knob.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhC;IAGD,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAElC;IAGD,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjC;IAGD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAMtE;IAGD,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnC;IAGD,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD;CACJ"}
package/dist/Knob.js ADDED
@@ -0,0 +1,51 @@
1
+ // {§env-knob} — a knob is read from the system environment, and its value lives on the panel and
2
+ // nowhere else ({§operator-config-only-home}). The floor guarantees every declared key, so an unset
3
+ // key is a broken deployment and an invalid one is the operator's mistake: both crash by name, never
4
+ // degrade. No reader here accepts a value, because a signature that could carry one is a second home
5
+ // for a choice. This is the one reader; a package that spells its own has a second home for the rule.
6
+ export default class Knob {
7
+ static text(name) {
8
+ const raw = process.env[name];
9
+ if (raw === undefined)
10
+ throw new Error(`${name} is missing from the assembled environment floor.`);
11
+ return raw;
12
+ }
13
+ // A comma list; empty is the empty list.
14
+ static list(name) {
15
+ return Knob.text(name).split(",").map((item) => item.trim()).filter((item) => item.length > 0);
16
+ }
17
+ // The house switch: exactly 0 or 1.
18
+ static flag(name) {
19
+ const raw = Knob.text(name);
20
+ if (raw !== "0" && raw !== "1")
21
+ throw new Error(`${name} must be 0 or 1; got ${JSON.stringify(raw)}.`);
22
+ return raw === "1";
23
+ }
24
+ // `options` is the vocabulary the operator chooses from, never a choice made for them.
25
+ static choice(name, options) {
26
+ const raw = Knob.text(name);
27
+ if (!options.includes(raw)) {
28
+ throw new Error(`${name} must be one of ${options.join(", ")}; got ${JSON.stringify(raw)}.`);
29
+ }
30
+ return raw;
31
+ }
32
+ // The panel's own notation, a share strictly between nothing and everything: `80%` is 0.8.
33
+ static percent(name) {
34
+ const raw = Knob.text(name);
35
+ const percent = Number(/^([0-9]+(?:\.[0-9]+)?)%$/u.exec(raw)?.[1]);
36
+ if (!Number.isFinite(percent) || percent <= 0 || percent >= 100) {
37
+ throw new Error(`${name} must be a percentage in (0, 100); got ${JSON.stringify(raw)}.`);
38
+ }
39
+ return percent / 100;
40
+ }
41
+ // `floor` is a bound on what the operator may say, never a value used in the operator's place.
42
+ static integer(name, floor) {
43
+ const raw = Knob.text(name);
44
+ const value = Number(raw);
45
+ if (raw.trim().length === 0 || !Number.isSafeInteger(value) || value < floor) {
46
+ throw new Error(`${name} must be a safe integer of at least ${floor}; got ${JSON.stringify(raw)}.`);
47
+ }
48
+ return value;
49
+ }
50
+ }
51
+ //# sourceMappingURL=Knob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Knob.js","sourceRoot":"","sources":["../src/Knob.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,oGAAoG;AACpG,qGAAqG;AACrG,qGAAqG;AACrG,sGAAsG;AACtG,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,MAAM,CAAC,IAAI,CAAC,IAAY;QACpB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,GAAG,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,mDAAmD,CAAC,CAAC;QACnG,OAAO,GAAG,CAAC;IACf,CAAC;IAED,yCAAyC;IACzC,MAAM,CAAC,IAAI,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,C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C;IACzB,CAAC;IAED,+FAA+F;IAC/F,MAAM,CAAC,OAAO,CAAC,IAAY,EAAE,KAAa;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,KAAK,EAAE,CAAC;YAC3E,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,uCAAuC,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxG,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,15 @@
1
+ export { default as Knob } from "./Knob.ts";
2
+ export { default as ErrorDetail } from "./ErrorDetail.ts";
1
3
  export interface PackageCandidate {
2
4
  dir: string;
3
5
  name: string;
4
6
  }
5
7
  export type PluginKind = "exec" | "mimetype" | "provider" | "scheme" | "http-materializer" | "module";
8
+ export interface PluginManifest {
9
+ readonly manifestPath: string;
10
+ readonly packageName: string | null;
11
+ readonly plurnk: Record<string, unknown>;
12
+ }
6
13
  export type PluginAttributionDeclaration = string | string[];
7
14
  export type PluginAttribution = readonly string[];
8
15
  export type PackageAttributions = ReadonlyMap<string, PluginAttribution>;
@@ -16,6 +23,7 @@ export interface PluginAttributionContext {
16
23
  export interface PluginAttributionSource {
17
24
  attributions?(context: PluginAttributionContext): PluginAttributionDeclaration | null | undefined;
18
25
  }
26
+ export { observed, observedSync } from "./observe.ts";
19
27
  export declare const TEACHING_CORPUS: Readonly<{
20
28
  readonly policy: "POLICY.md";
21
29
  readonly recap: "recap.md";
@@ -28,6 +36,9 @@ export type TeachingCorpusSource = typeof TEACHING_CORPUS.policy | typeof TEACHI
28
36
  export default class Meta {
29
37
  #private;
30
38
  static declaresKind(manifest: unknown, kind: PluginKind): boolean;
39
+ static readManifest(dir: string, kind: PluginKind, { signal }?: {
40
+ signal?: AbortSignal;
41
+ }): Promise<PluginManifest | null>;
31
42
  static isTrusted(packageName: string, env?: Record<string, string | undefined>): boolean;
32
43
  static normalizeAttribution(raw: unknown, packageName: string): PluginAttribution;
33
44
  static runtimeAttribution(source: unknown, context: PluginAttributionContext, packageName: string): PluginAttribution;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,mBAAmB,GAAG,QAAQ,CAAC;AAItG,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GAAG,SAAS,MAAM,EAAE,CAAC;AAClD,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAEzE,MAAM,WAAW,wBAAwB;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACpC,YAAY,CAAC,CAAC,OAAO,EAAE,wBAAwB,GAAG,4BAA4B,GAAG,IAAI,GAAG,SAAS,CAAC;CACrG;AAQD,eAAO,MAAM,eAAe;qBAChB,WAAW;oBACZ,UAAU;oBACV,wBAAwB;;yBARvB,gBAAgB;;EAWjB,CAA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AAC,MAAM,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;AAOnF,MAAM,CAAC,OAAO,OAAO,IAAI;;IAGrB,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAGhE;IAKD,OAAa,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAqBlI;IAqBD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,OAAO,CAMpG;IAED,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAiBhF;IAKD,MAAM,CAAC,kBAAkB,CACrB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,wBAAwB,EACjC,WAAW,EAAE,MAAM,GACpB,iBAAiB,CAcnB;IAED,MAAM,CAAC,mBAAmB,CAAC,GAAG,KAAK,EAAE,SAAS,iBAAiB,EAAE,GAAG,iBAAiB,CAIpF;IAkCD,OAAa,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAyB5E;IAED,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASxD;CACJ"}
package/dist/index.js CHANGED
@@ -1,6 +1,13 @@
1
1
  // The metaproject layer's membership slice — the mechanics every discovery
2
2
  // surface shares ({§plugin-discovery} / {§operator-config-env-defaults}):
3
3
  // - declaresKind: the ONE package → capability-family representation.
4
+ // - readManifest: the ONE package.json read: a family's manifest, or null for
5
+ // anything that is not a package of that family. Field
6
+ // validation past the family claim is the caller's.
7
+ // - Knob: the ONE environment reader: the panel's value by name, or a
8
+ // crash by name ({§env-knob}).
9
+ // - ErrorDetail: the ONE diagnostic-preview bound, per package knob
10
+ // ({§error-detail-bound}).
4
11
  // - isTrusted: THE trust rule. One implementation; a second definition
5
12
  // of membership trust anywhere in the family is a bug.
6
13
  // - normalizeAttribution:
@@ -16,16 +23,19 @@
16
23
  // checkouts escape node_modules via symlink realpaths and
17
24
  // land on the monorepo root's. Null when nothing is found;
18
25
  // the fallback is the caller's policy.
19
- import { readdir } from "node:fs/promises";
26
+ import { readdir, readFile } from "node:fs/promises";
20
27
  import { existsSync, readFileSync } from "node:fs";
21
28
  import { parseEnv } from "node:util";
22
29
  import path from "node:path";
23
30
  import { fileURLToPath } from "node:url";
31
+ export { default as Knob } from "./Knob.js";
32
+ export { default as ErrorDetail } from "./ErrorDetail.js";
24
33
  const SCHEME_TEACHING = Object.freeze({
25
34
  worker: "docs/worker.md",
26
35
  });
27
36
  // {§teaching-corpus} — the authored package membership is one exported fact;
28
37
  // consumers decide when and where each required source is projected.
38
+ export { observed, observedSync } from "./observe.js";
29
39
  export const TEACHING_CORPUS = Object.freeze({
30
40
  policy: "POLICY.md",
31
41
  recap: "recap.md",
@@ -42,6 +52,36 @@ export default class Meta {
42
52
  return false;
43
53
  return manifest.kind === kind;
44
54
  }
55
+ // {§plugin-manifest-read} — null for a missing or malformed package.json, a non-object,
56
+ // no `plurnk` object, or another family: none of those is a package of this family, and
57
+ // discovery skips them without a word. An abort is the caller's contract and surfaces.
58
+ static async readManifest(dir, kind, { signal } = {}) {
59
+ const manifestPath = path.join(dir, "package.json");
60
+ let raw;
61
+ try {
62
+ raw = await readFile(manifestPath, { encoding: "utf8", signal });
63
+ }
64
+ catch (err) {
65
+ if (err instanceof Error && err.name === "AbortError")
66
+ throw err;
67
+ return null;
68
+ }
69
+ let pkg;
70
+ try {
71
+ pkg = JSON.parse(raw);
72
+ }
73
+ catch {
74
+ return null;
75
+ }
76
+ if (typeof pkg !== "object" || pkg === null)
77
+ return null;
78
+ const record = pkg;
79
+ const plurnk = record.plurnk;
80
+ if (typeof plurnk !== "object" || plurnk === null || !Meta.declaresKind(plurnk, kind))
81
+ return null;
82
+ const packageName = typeof record.name === "string" && record.name.length > 0 ? record.name : null;
83
+ return { manifestPath, packageName, plurnk: plurnk };
84
+ }
45
85
  // {§operator-config-only-home} — the trust gate is asked while the floor is still being
46
86
  // assembled (it decides whose panel joins it), so an unset key cannot mean "the panel said
47
87
  // nothing". This package owns the key, so it reads its own panel: the operator's environment
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,kFAAkF;AAClF,+EAA+E;AAC/E,4BAA4B;AAC5B,4EAA4E;AAC5E,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,6EAA6E;AAC7E,2CAA2C;AAC3C,8EAA8E;AAC9E,iFAAiF;AACjF,4EAA4E;AAC5E,kFAAkF;AAClF,mFAAmF;AACnF,+DAA+D;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA2BzC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,gBAAgB;CAClB,CAAC,CAAC;AAEZ,6EAA6E;AAC7E,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,wBAAwB;IAC/B,UAAU,EAAE,eAAe;CAErB,CAA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I,IAAI,KAAK,IAAI;gBAAE,MAAM;YACzB,GAAG,GAAG,IAAI,CAAC;QACf,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,OAAe;QACrC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,IAAI,EAAE,CAAC;YACV,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YACjD,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBAAE,OAAO,SAAS,CAAC;YAClE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,MAAM,KAAK,GAAG;gBAAE,OAAO,IAAI,CAAC;YAChC,GAAG,GAAG,MAAM,CAAC;QACjB,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,4 @@
1
+ import { type Span, type SpanOptions, type Tracer } from "@opentelemetry/api";
2
+ export declare const observed: <T>(tracer: Tracer, name: string, attributes: Record<string, unknown>, fn: (span: Span) => Promise<T>, options?: SpanOptions) => Promise<T>;
3
+ export declare const observedSync: <T>(tracer: Tracer, name: string, attributes: Record<string, unknown>, fn: (span: Span) => T, options?: SpanOptions) => T;
4
+ //# sourceMappingURL=observe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAuC9G,eAAO,MAAM,QAAQ,GAAU,CAAC,UACpB,MAAM,QACR,MAAM,cACA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAC/B,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YACpB,WAAW,KACtB,OAAO,CAAC,CAAC,CAUX,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,UAClB,MAAM,QACR,MAAM,cACA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAC/B,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,YACX,WAAW,KACtB,CAUF,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { context, SpanStatusCode, trace } from "@opentelemetry/api";
2
+ // {§observed-span} — redaction-first span helpers shared by every instrumented package. Callers
3
+ // pass identifiers, counts and statuses only; string values are length-capped as a backstop, and a
4
+ // failure marks the span ERROR with the error's class name, never its message.
5
+ const MAX_STRING_LENGTH = 300;
6
+ const errorType = (error) => {
7
+ const name = error instanceof Error ? error.constructor.name : typeof error;
8
+ return name.length <= MAX_STRING_LENGTH ? name : name.slice(0, MAX_STRING_LENGTH);
9
+ };
10
+ const sanitize = (attributes) => {
11
+ const out = {};
12
+ for (const [key, value] of Object.entries(attributes)) {
13
+ if (value === undefined)
14
+ continue;
15
+ if (typeof value === "string") {
16
+ out[key] = value.length <= MAX_STRING_LENGTH ? value : value.slice(0, MAX_STRING_LENGTH);
17
+ }
18
+ else if (typeof value === "number" || typeof value === "boolean") {
19
+ out[key] = value;
20
+ }
21
+ }
22
+ return out;
23
+ };
24
+ const spanOptions = (attributes, options) => ({
25
+ ...options,
26
+ attributes: {
27
+ ...sanitize(attributes),
28
+ ...(options?.attributes === undefined ? {} : sanitize(options.attributes)),
29
+ },
30
+ });
31
+ const failed = (span, error) => {
32
+ span.setAttribute("error.type", errorType(error));
33
+ span.setStatus({ code: SpanStatusCode.ERROR });
34
+ };
35
+ export const observed = async (tracer, name, attributes, fn, options) => {
36
+ const span = tracer.startSpan(name, spanOptions(attributes, options));
37
+ try {
38
+ return await context.with(trace.setSpan(context.active(), span), () => fn(span));
39
+ }
40
+ catch (error) {
41
+ failed(span, error);
42
+ throw error;
43
+ }
44
+ finally {
45
+ span.end();
46
+ }
47
+ };
48
+ export const observedSync = (tracer, name, attributes, fn, options) => {
49
+ const span = tracer.startSpan(name, spanOptions(attributes, options));
50
+ try {
51
+ return fn(span);
52
+ }
53
+ catch (error) {
54
+ failed(span, error);
55
+ throw error;
56
+ }
57
+ finally {
58
+ span.end();
59
+ }
60
+ };
61
+ //# sourceMappingURL=observe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observe.js","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAA4C,MAAM,oBAAoB,CAAC;AAE9G,gGAAgG;AAChG,mGAAmG;AACnG,+EAA+E;AAE/E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,SAAS,GAAG,CAAC,KAAc,EAAU,EAAE;IACzC,MAAM,IAAI,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;IAC5E,OAAO,IAAI,CAAC,MAAM,IAAI,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,UAAmC,EAA6C,EAAE;IAChG,MAAM,GAAG,GAA8C,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAC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AK,CAAC,CAAC;QACpB,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CACxB,MAAc,EACd,IAAY,EACZ,UAAmC,EACnC,EAAqB,EACrB,OAAqB,EACpB,EAAE;IACH,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpB,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;AACL,CAAC,CAAC"}
package/docs/worker.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Summary
4
4
 
5
- Coordinate workers, request isolated BARE inference, and manage workspace entries.
5
+ Coordinate workers (WORK, FORK), request isolated BARE inference, and manage workspace entries.
6
6
 
7
7
  Workers inhabit one workspace. The authority selects a worker; a path selects
8
8
  an entry rather than controlling that worker.
@@ -16,7 +16,9 @@ an entry rather than controlling that worker.
16
16
  | `worker:///example.md` | Shared commons entry | Read and write. |
17
17
 
18
18
  The packet's `## Worker` block, below the log, names your worker, its parent
19
- (`null` at a root), and the loop and turn you are producing. Addresses are
19
+ (`null` at a root), the loop and turn you are producing, and `previousEmission`, the
20
+ address of the program you submitted last: the log rows at that coordinate are its
21
+ receipts. Addresses are
20
22
  literal and keep the same meaning when passed to another worker. Scratch
21
23
  belongs to the workspace; a namespace does not require a namesake worker.
22
24
  Generated references live under `worker:///_plurnk/`, and reference refreshes
@@ -32,6 +34,12 @@ the default channel stays the source, and a pattern matches the channel it
32
34
  addresses. The projection follows every source write and is never written
33
35
  itself.
34
36
 
37
+ A READ of an image, PDF or audio source retains its bytes: on a route whose
38
+ model takes that media, every later packet carries them as a native part
39
+ captioned with the READ's log coordinate, until you KILL that READ row. The
40
+ service never re-sends media; a captioned part is your own earlier READ, not a
41
+ new arrival.
42
+
35
43
  ## Delegation
36
44
 
37
45
  WORK starts a fresh log with the task body as its prompt; FORK copies your
@@ -43,6 +51,10 @@ an existing worker, even after it finishes. Names match
43
51
  worker gives it a follow-up task. `[{"env": {...}}]` on WORK or FORK is the
44
52
  child's starting environment (`env.md`).
45
53
 
54
+ ```FORK (worker://exampleWorkerName) <!-- a sibling that begins with your history -->
55
+ The child's task, continuing from what you already know.
56
+ ```
57
+
46
58
  Parents observe a direct child's mutations, messages, executor invocations, and
47
59
  worker launches, including failed actions, as rows in their own log.
48
60
  Exploration and context curation (NOTE, READ, FIND, BARE, WAIT, and log KILL)
@@ -100,11 +112,16 @@ ordinary message from `schedule://<alias>`.
100
112
 
101
113
  ## BARE inference
102
114
 
103
- BARE makes one isolated call to the child model, not a persistent worker. It
104
- receives no parent history or tools. Its prompt is the fence body.
115
+ BARE makes one isolated call to the model, not a persistent worker. Nothing
116
+ reaches it but the fence body: no log, no files, no web, no tools, no memory of
117
+ this loop. It answers from the body and the model's own knowledge alone, so it
118
+ cannot look anything up, and what it does not know it will guess. Use it to
119
+ isolate a sub-problem whose complete inputs fit in the body — a long text to
120
+ judge, a tangle to reason through without the log in view — never to search,
121
+ recall, or fetch.
105
122
 
106
123
  ```BARE
107
- A self-contained prompt.
124
+ A self-contained prompt, with everything it needs pasted in.
108
125
  ```
109
126
 
110
127
  The prompt is not truncated to fit; provider capacity still applies.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plurnk/plurnk-meta",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "Plugin discovery and trust primitives shared by plurnk plugin families, and the teaching material the plurnk service gives models: policy, Recap, the plurnk skill and scheme references.",
5
5
  "keywords": [
6
6
  "plurnk",
@@ -13,6 +13,9 @@
13
13
  "engines": {
14
14
  "node": ">=26"
15
15
  },
16
+ "dependencies": {
17
+ "@opentelemetry/api": "^1.9.1"
18
+ },
16
19
  "files": [
17
20
  ".env.defaults",
18
21
  "dist/**/*",