@plurnk/plurnk-service 0.2.0 → 0.4.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 +98 -112
- package/dist/core/ChannelWrite.d.ts +10 -0
- package/dist/core/ChannelWrite.d.ts.map +1 -1
- package/dist/core/ChannelWrite.js.map +1 -1
- package/dist/core/Engine.d.ts +10 -2
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +410 -113
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/ProviderRegistry.d.ts +1 -1
- package/dist/core/ProviderRegistry.d.ts.map +1 -1
- package/dist/core/ProviderRegistry.js.map +1 -1
- package/dist/core/line-marker.d.ts +23 -0
- package/dist/core/line-marker.d.ts.map +1 -0
- package/dist/core/line-marker.js +321 -0
- package/dist/core/line-marker.js.map +1 -0
- package/dist/core/matcher.d.ts +14 -0
- package/dist/core/matcher.d.ts.map +1 -0
- package/dist/core/matcher.js +195 -0
- package/dist/core/matcher.js.map +1 -0
- package/dist/core/mimetype-binary.d.ts +6 -0
- package/dist/core/mimetype-binary.d.ts.map +1 -0
- package/dist/core/mimetype-binary.js +82 -0
- package/dist/core/mimetype-binary.js.map +1 -0
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +174 -33
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/path-mimetype.d.ts +3 -0
- package/dist/core/path-mimetype.d.ts.map +1 -0
- package/dist/core/path-mimetype.js +47 -0
- package/dist/core/path-mimetype.js.map +1 -0
- package/dist/core/scheme-types.d.ts +5 -0
- package/dist/core/scheme-types.d.ts.map +1 -1
- package/dist/core/scheme-types.js.map +1 -1
- package/dist/providers/Mock.d.ts +2 -2
- package/dist/providers/Mock.d.ts.map +1 -1
- package/dist/providers/Mock.js.map +1 -1
- package/dist/schemes/Exec.d.ts +30 -1
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +229 -6
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/File.d.ts +8 -4
- package/dist/schemes/File.d.ts.map +1 -1
- package/dist/schemes/File.js +184 -68
- package/dist/schemes/File.js.map +1 -1
- package/dist/schemes/Known.js +1 -1
- package/dist/schemes/Known.js.map +1 -1
- package/dist/schemes/Log.d.ts +9 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +120 -19
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Plurnk.d.ts +15 -1
- package/dist/schemes/Plurnk.d.ts.map +1 -1
- package/dist/schemes/Plurnk.js +50 -8
- package/dist/schemes/Plurnk.js.map +1 -1
- package/dist/schemes/Skill.js +1 -1
- package/dist/schemes/Skill.js.map +1 -1
- package/dist/schemes/Unknown.js +1 -1
- package/dist/schemes/Unknown.js.map +1 -1
- package/dist/schemes/_entry-crud.d.ts +5 -3
- package/dist/schemes/_entry-crud.d.ts.map +1 -1
- package/dist/schemes/_entry-crud.js +1 -0
- package/dist/schemes/_entry-crud.js.map +1 -1
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +64 -15
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-ops.d.ts +3 -0
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +269 -72
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-send.d.ts.map +1 -1
- package/dist/schemes/_entry-send.js +14 -7
- package/dist/schemes/_entry-send.js.map +1 -1
- package/dist/server/ClientConnection.d.ts +3 -2
- package/dist/server/ClientConnection.d.ts.map +1 -1
- package/dist/server/ClientConnection.js +10 -2
- package/dist/server/ClientConnection.js.map +1 -1
- package/dist/server/Daemon.d.ts +40 -1
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +319 -1
- package/dist/server/Daemon.js.map +1 -1
- package/dist/server/MethodRegistry.d.ts +29 -0
- package/dist/server/MethodRegistry.d.ts.map +1 -1
- package/dist/server/MethodRegistry.js.map +1 -1
- package/dist/server/dsl.d.ts +2 -2
- package/dist/server/dsl.d.ts.map +1 -1
- package/dist/server/dsl.js +10 -10
- package/dist/server/dsl.js.map +1 -1
- package/dist/server/envelope.d.ts +2 -1
- package/dist/server/envelope.d.ts.map +1 -1
- package/dist/server/envelope.js +11 -8
- package/dist/server/envelope.js.map +1 -1
- package/dist/server/logEntry.d.ts +9 -9
- package/dist/server/logEntry.d.ts.map +1 -1
- package/dist/server/logEntry.js +10 -10
- package/dist/server/logEntry.js.map +1 -1
- package/dist/server/methods/_dispatchAsClient.d.ts.map +1 -1
- package/dist/server/methods/_dispatchAsClient.js +7 -2
- package/dist/server/methods/_dispatchAsClient.js.map +1 -1
- package/dist/server/methods/entry_read.js +5 -5
- package/dist/server/methods/entry_read.js.map +1 -1
- package/dist/server/methods/loop_cancel.d.ts +3 -0
- package/dist/server/methods/loop_cancel.d.ts.map +1 -0
- package/dist/server/methods/loop_cancel.js +27 -0
- package/dist/server/methods/loop_cancel.js.map +1 -0
- package/dist/server/methods/loop_run.d.ts.map +1 -1
- package/dist/server/methods/loop_run.js +53 -49
- package/dist/server/methods/loop_run.js.map +1 -1
- package/dist/server/methods/op_edit.js +3 -3
- package/dist/server/methods/op_edit.js.map +1 -1
- package/dist/server/methods/op_hide.js +3 -3
- package/dist/server/methods/op_hide.js.map +1 -1
- package/dist/server/methods/op_read.js +3 -3
- package/dist/server/methods/op_read.js.map +1 -1
- package/dist/server/methods/op_show.js +3 -3
- package/dist/server/methods/op_show.js.map +1 -1
- package/migrations/001_schema.sql +324 -0
- package/package.json +19 -12
- package/migrations/001_sessions.sql +0 -11
- package/migrations/002_runs.sql +0 -16
- package/migrations/003_loops.sql +0 -12
- package/migrations/004_turns.sql +0 -18
- package/migrations/005_entries.sql +0 -44
- package/migrations/006_log_entries.sql +0 -51
- package/migrations/007_visibility.sql +0 -10
- package/migrations/008_schemes_providers.sql +0 -25
- package/migrations/009_cost_rollups.sql +0 -44
- package/migrations/010_subscriptions.sql +0 -36
- package/migrations/011_turn_call_metadata.sql +0 -7
- package/migrations/012_proposal_lifecycle.sql +0 -22
- package/migrations/013_log_entries_lifecycle_columns.sql +0 -22
- package/migrations/014_loop_flags.sql +0 -9
- package/migrations/015_sessions_project_root.sql +0 -6
- package/migrations/016_persona_columns.sql +0 -11
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Body-matcher dispatch for FIND / READ / SHOW / HIDE (plurnk.md
|
|
2
|
+
// §"Body matcher dispatch"). The grammar parser classifies the dialect
|
|
3
|
+
// at parse time and emits a discriminated MatcherBody:
|
|
4
|
+
//
|
|
5
|
+
// { dialect: "xpath", raw, ... }
|
|
6
|
+
// { dialect: "regex", raw, pattern, flags }
|
|
7
|
+
// { dialect: "jsonpath", raw, ... }
|
|
8
|
+
// { dialect: "glob", raw }
|
|
9
|
+
//
|
|
10
|
+
// Regex + glob are universal text matching. xpath + jsonpath are
|
|
11
|
+
// inherently mimetype-bound and belong on per-mimetype handlers in
|
|
12
|
+
// @plurnk/plurnk-mimetypes (plurnk-mimetypes#3). 501 with sibling-issue
|
|
13
|
+
// pointer until landed.
|
|
14
|
+
//
|
|
15
|
+
// Mimetype-mismatch rule (AGENTS.md "Resolved ambiguities" §1): dialect
|
|
16
|
+
// on a wrong mimetype family returns 415. Binary entries are 415 across
|
|
17
|
+
// the board (§2).
|
|
18
|
+
//
|
|
19
|
+
// Result shape (AGENTS.md "Matcher return semantics rework"):
|
|
20
|
+
// Body is a JSON array of per-match objects `{line, matched, matching?}`.
|
|
21
|
+
// `line`: 1-indexed source line of the match.
|
|
22
|
+
// `matched`: extracted value, polymorphic by extractor:
|
|
23
|
+
// bare regex → string (full match)
|
|
24
|
+
// anon captures → array of capture strings
|
|
25
|
+
// named captures → object {name: value, …}; mixed anon mixes in "1"/"2"
|
|
26
|
+
// jsonpath → JSON value at the path
|
|
27
|
+
// xpath text/attr → string
|
|
28
|
+
// xpath node → serialized XML string
|
|
29
|
+
// `matching`: per-instance discriminator when matcher targets multiple
|
|
30
|
+
// instances (jsonpath wildcards, xpath multi-match). Omitted otherwise.
|
|
31
|
+
// Empty matches → status 204, no body.
|
|
32
|
+
// Result mimetype is always "application/json" for matcher results.
|
|
33
|
+
import { isBinaryMimetype } from "./mimetype-binary.js";
|
|
34
|
+
const isXmlFamily = (mimetype) => mimetype === "text/html" || mimetype === "application/xml" || mimetype.endsWith("+xml");
|
|
35
|
+
const isJsonFamily = (mimetype) => mimetype === "application/json" || mimetype.endsWith("+json");
|
|
36
|
+
// Count newlines in content[0..offset) to compute 1-indexed source line.
|
|
37
|
+
const lineOfOffset = (content, offset, baseLine) => {
|
|
38
|
+
let line = baseLine;
|
|
39
|
+
for (let i = 0; i < offset && i < content.length; i++) {
|
|
40
|
+
if (content.charCodeAt(i) === 0x0a)
|
|
41
|
+
line++;
|
|
42
|
+
}
|
|
43
|
+
return line;
|
|
44
|
+
};
|
|
45
|
+
// Extract `matched` shape from a RegExp match result.
|
|
46
|
+
// - No captures: string (full match)
|
|
47
|
+
// - Anon only: array of capture strings
|
|
48
|
+
// - Named (any): object with name keys; anon captures merged in as "1", "2", …
|
|
49
|
+
const matchedFromRegex = (m) => {
|
|
50
|
+
const anonCount = m.length - 1; // m[0] is full match
|
|
51
|
+
const groups = m.groups;
|
|
52
|
+
const hasNamed = groups !== undefined && Object.keys(groups).length > 0;
|
|
53
|
+
if (anonCount === 0 && !hasNamed)
|
|
54
|
+
return m[0]; // bare match
|
|
55
|
+
if (hasNamed) {
|
|
56
|
+
// Object form: named captures by name, anon captures by positional key.
|
|
57
|
+
const obj = { ...groups };
|
|
58
|
+
// Identify which capture indices are named (so we don't double-count).
|
|
59
|
+
// RegExp doesn't expose this directly; collect named values and check
|
|
60
|
+
// each anon position for presence in groups.
|
|
61
|
+
const namedValues = new Set(Object.values(groups));
|
|
62
|
+
for (let i = 1; i <= anonCount; i++) {
|
|
63
|
+
const v = m[i];
|
|
64
|
+
// Heuristic: include anon-indexed capture if it's not the same
|
|
65
|
+
// reference as a named one. Imperfect when values collide; the
|
|
66
|
+
// common case (truly distinct anon + named) works.
|
|
67
|
+
if (!namedValues.has(v))
|
|
68
|
+
obj[String(i)] = v;
|
|
69
|
+
}
|
|
70
|
+
return obj;
|
|
71
|
+
}
|
|
72
|
+
// Anonymous-only: array of captures.
|
|
73
|
+
const arr = [];
|
|
74
|
+
for (let i = 1; i <= anonCount; i++)
|
|
75
|
+
arr.push(m[i]);
|
|
76
|
+
return arr;
|
|
77
|
+
};
|
|
78
|
+
const prettyJson = (value) => JSON.stringify(value, null, 2);
|
|
79
|
+
// Convert a shell-style glob pattern to a RegExp for full-line matching.
|
|
80
|
+
// Per plurnk-grammar#17 closing comment, glob in READ body is a line
|
|
81
|
+
// filter: each content line tested against the glob; matching lines
|
|
82
|
+
// yield rows. Conventions match shell globs:
|
|
83
|
+
// `TODO*` → starts with TODO (`^TODO.*$`)
|
|
84
|
+
// `*TODO*` → contains TODO (`^.*TODO.*$`)
|
|
85
|
+
// `*.log` → ends with `.log` (`^.*\.log$`)
|
|
86
|
+
// `[Tt]odo*`→ char class anchor (`^[Tt]odo.*$`)
|
|
87
|
+
// Model controls anchoring via the pattern; no implicit "contains" wrapping.
|
|
88
|
+
const globToLineRegex = (glob) => {
|
|
89
|
+
let pattern = "^";
|
|
90
|
+
let i = 0;
|
|
91
|
+
while (i < glob.length) {
|
|
92
|
+
const c = glob[i];
|
|
93
|
+
if (c === "*") {
|
|
94
|
+
pattern += ".*";
|
|
95
|
+
}
|
|
96
|
+
else if (c === "?") {
|
|
97
|
+
pattern += ".";
|
|
98
|
+
}
|
|
99
|
+
else if (c === "[") {
|
|
100
|
+
// Character class — pass through with `!` → `^` per glob convention.
|
|
101
|
+
let cls = "[";
|
|
102
|
+
i++;
|
|
103
|
+
if (i < glob.length && (glob[i] === "!" || glob[i] === "^")) {
|
|
104
|
+
cls += "^";
|
|
105
|
+
i++;
|
|
106
|
+
}
|
|
107
|
+
while (i < glob.length && glob[i] !== "]") {
|
|
108
|
+
cls += glob[i];
|
|
109
|
+
i++;
|
|
110
|
+
}
|
|
111
|
+
cls += "]";
|
|
112
|
+
pattern += cls;
|
|
113
|
+
}
|
|
114
|
+
else if (".+(){}|^$\\".includes(c)) {
|
|
115
|
+
pattern += `\\${c}`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
pattern += c;
|
|
119
|
+
}
|
|
120
|
+
i++;
|
|
121
|
+
}
|
|
122
|
+
pattern += "$";
|
|
123
|
+
return new RegExp(pattern);
|
|
124
|
+
};
|
|
125
|
+
// Apply a matcher against text content. Returns a JSON-array body of
|
|
126
|
+
// per-match objects on success, or status 204 with no body when there
|
|
127
|
+
// are zero matches.
|
|
128
|
+
//
|
|
129
|
+
// `baseLine` is the 1-indexed line of `content[0]` in the original
|
|
130
|
+
// source. When the matcher runs against the full content, baseLine=1;
|
|
131
|
+
// when called from inside a `<L>` slice path, baseLine = slice startLine
|
|
132
|
+
// so per-match line numbers are reported in original-source coordinates.
|
|
133
|
+
export const matchAgainstContent = (body, content, mimetype, baseLine = 1) => {
|
|
134
|
+
if (isBinaryMimetype(mimetype)) {
|
|
135
|
+
return { status: 415, error: `cannot match against binary mimetype \`${mimetype}\`` };
|
|
136
|
+
}
|
|
137
|
+
if (body.dialect === "regex") {
|
|
138
|
+
let re;
|
|
139
|
+
try {
|
|
140
|
+
re = new RegExp(body.pattern, body.flags);
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
return { status: 400, error: err instanceof Error ? err.message : String(err) };
|
|
144
|
+
}
|
|
145
|
+
const rows = [];
|
|
146
|
+
if (body.flags.includes("g")) {
|
|
147
|
+
for (const m of content.matchAll(re)) {
|
|
148
|
+
const line = lineOfOffset(content, m.index ?? 0, baseLine);
|
|
149
|
+
rows.push({ line, matched: matchedFromRegex(m) });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
const m = re.exec(content);
|
|
154
|
+
if (m !== null) {
|
|
155
|
+
const line = lineOfOffset(content, m.index, baseLine);
|
|
156
|
+
rows.push({ line, matched: matchedFromRegex(m) });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (rows.length === 0)
|
|
160
|
+
return { status: 204, matches: 0 };
|
|
161
|
+
return { status: 200, body: prettyJson(rows), matches: rows.length };
|
|
162
|
+
}
|
|
163
|
+
if (body.dialect === "xpath") {
|
|
164
|
+
if (!isXmlFamily(mimetype))
|
|
165
|
+
return { status: 415, error: `xpath requires xml/html mimetype; got \`${mimetype}\`` };
|
|
166
|
+
return { status: 501, error: "xpath not implemented (see plurnk-mimetypes#3)" };
|
|
167
|
+
}
|
|
168
|
+
if (body.dialect === "jsonpath") {
|
|
169
|
+
if (!isJsonFamily(mimetype))
|
|
170
|
+
return { status: 415, error: `jsonpath requires json mimetype; got \`${mimetype}\`` };
|
|
171
|
+
return { status: 501, error: "jsonpath not implemented (see plurnk-mimetypes#3)" };
|
|
172
|
+
}
|
|
173
|
+
// glob in READ body = line filter (plurnk-grammar#17 ratification).
|
|
174
|
+
// Each content line tested against the glob pattern; matching lines
|
|
175
|
+
// yield `{line, matched: <lineContent>}` rows. Complements regex
|
|
176
|
+
// (substring/capture extraction); glob is the grep-like primitive.
|
|
177
|
+
let re;
|
|
178
|
+
try {
|
|
179
|
+
re = globToLineRegex(body.raw);
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
return { status: 400, error: err instanceof Error ? err.message : String(err) };
|
|
183
|
+
}
|
|
184
|
+
const lines = content.split("\n");
|
|
185
|
+
const rows = [];
|
|
186
|
+
lines.forEach((line, i) => {
|
|
187
|
+
if (re.test(line)) {
|
|
188
|
+
rows.push({ line: baseLine + i, matched: line });
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
if (rows.length === 0)
|
|
192
|
+
return { status: 204, matches: 0 };
|
|
193
|
+
return { status: 200, body: prettyJson(rows), matches: rows.length };
|
|
194
|
+
};
|
|
195
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AC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isBinaryMimetype: (mimetype: string) => boolean;
|
|
2
|
+
export declare const isJsonMimetype: (mimetype: string) => boolean;
|
|
3
|
+
export declare const isLineNavigableMimetype: (mimetype: string) => boolean;
|
|
4
|
+
export declare const TEXT_PRIMITIVE_MIMETYPE = "text/markdown";
|
|
5
|
+
export declare const normalizeAutoTextMimetype: (mimetype: string | null | undefined) => string;
|
|
6
|
+
//# sourceMappingURL=mimetype-binary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mimetype-binary.d.ts","sourceRoot":"","sources":["../../src/core/mimetype-binary.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,KAAG,OASnD,CAAC;AAKF,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,OACe,CAAC;AAElE,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,OAS1D,CAAC;AAaF,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,eAAO,MAAM,yBAAyB,GAAI,UAAU,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAK/E,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Mimetype classifiers used at op-handler boundaries.
|
|
2
|
+
//
|
|
3
|
+
// `isBinaryMimetype` — enforces 415 on binary entries for READ/EDIT/
|
|
4
|
+
// SHOW/HIDE (AGENTS.md "Resolved ambiguities" §2).
|
|
5
|
+
//
|
|
6
|
+
// `isLineNavigableMimetype` — decides whether the render layer prefixes
|
|
7
|
+
// each line with `N:\t` on READ output. Line-oriented mimetypes (text,
|
|
8
|
+
// markdown, source code, line-aligned configs) get `N:\t`. Tree-oriented
|
|
9
|
+
// mimetypes (JSON, XML, HTML) don't — line numbers would conflict with
|
|
10
|
+
// the structural navigation those formats use (jsonpath, xpath).
|
|
11
|
+
//
|
|
12
|
+
// Local heuristic until @plurnk/plurnk-mimetypes exposes per-mimetype
|
|
13
|
+
// metadata via its public API (HandlerInfo flags exist at registry
|
|
14
|
+
// level; not queryable per-mimetype yet — see plurnk-mimetypes#3).
|
|
15
|
+
const TEXT_APPLICATION_MIMETYPES = new Set([
|
|
16
|
+
"application/json",
|
|
17
|
+
"application/yaml",
|
|
18
|
+
"application/toml",
|
|
19
|
+
"application/xml",
|
|
20
|
+
"application/javascript",
|
|
21
|
+
"application/typescript",
|
|
22
|
+
"application/sql",
|
|
23
|
+
]);
|
|
24
|
+
// Mimetypes that are structurally tree-navigated rather than line-
|
|
25
|
+
// navigated. READ output of these doesn't get `N:\t` prefixes.
|
|
26
|
+
const TREE_NAVIGABLE_MIMETYPES = new Set([
|
|
27
|
+
"application/json",
|
|
28
|
+
"application/xml",
|
|
29
|
+
"text/html",
|
|
30
|
+
]);
|
|
31
|
+
export const isBinaryMimetype = (mimetype) => {
|
|
32
|
+
if (mimetype.length === 0)
|
|
33
|
+
return false;
|
|
34
|
+
const slash = mimetype.indexOf("/");
|
|
35
|
+
if (slash === -1)
|
|
36
|
+
return true;
|
|
37
|
+
const type = mimetype.slice(0, slash);
|
|
38
|
+
if (type === "text")
|
|
39
|
+
return false;
|
|
40
|
+
if (TEXT_APPLICATION_MIMETYPES.has(mimetype))
|
|
41
|
+
return false;
|
|
42
|
+
if (mimetype.endsWith("+json") || mimetype.endsWith("+xml") || mimetype.endsWith("+yaml"))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
// JSON-family check — used by `<L>` dispatch to pick structural slicer
|
|
47
|
+
// (sliceJsonItems) over line slicer (sliceLines) for JSON sources.
|
|
48
|
+
// Matches application/json plus +json suffix variants per RFC 6839.
|
|
49
|
+
export const isJsonMimetype = (mimetype) => mimetype === "application/json" || mimetype.endsWith("+json");
|
|
50
|
+
export const isLineNavigableMimetype = (mimetype) => {
|
|
51
|
+
if (mimetype.length === 0)
|
|
52
|
+
return false;
|
|
53
|
+
if (isBinaryMimetype(mimetype))
|
|
54
|
+
return false;
|
|
55
|
+
if (TREE_NAVIGABLE_MIMETYPES.has(mimetype))
|
|
56
|
+
return false;
|
|
57
|
+
if (mimetype.endsWith("+json") || mimetype.endsWith("+xml"))
|
|
58
|
+
return false;
|
|
59
|
+
// Everything text-ish that isn't tree-shaped is line-navigable.
|
|
60
|
+
// text/plain, text/markdown, text/csv, text/javascript, text/typescript,
|
|
61
|
+
// application/yaml, application/toml, application/javascript, etc.
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
64
|
+
// Text primitive for the agent contract: text/markdown is the default
|
|
65
|
+
// text mimetype anywhere plurnk-service auto-derives a text result.
|
|
66
|
+
// text/plain is reserved for explicit scheme-manifest declarations
|
|
67
|
+
// (exec subprocess streams) and client-set entries. Rationale: markdown
|
|
68
|
+
// is a strict superset of plain text — any plain text is valid markdown
|
|
69
|
+
// — so the agent gets markdown-aware processing capability for free,
|
|
70
|
+
// and never needs to decide "is this markdown enough to mark as
|
|
71
|
+
// markdown?"
|
|
72
|
+
//
|
|
73
|
+
// Use this at any consumer-side auto-derivation point (file scheme
|
|
74
|
+
// extension fallback, log rx wrap, etc.) to normalize text/plain → text/markdown.
|
|
75
|
+
export const TEXT_PRIMITIVE_MIMETYPE = "text/markdown";
|
|
76
|
+
export const normalizeAutoTextMimetype = (mimetype) => {
|
|
77
|
+
if (mimetype === null || mimetype === undefined || mimetype === "" || mimetype === "text/plain") {
|
|
78
|
+
return TEXT_PRIMITIVE_MIMETYPE;
|
|
79
|
+
}
|
|
80
|
+
return mimetype;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=mimetype-binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mimetype-binary.js","sourceRoot":"","sources":["../../src/core/mimetype-binary.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,E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C,QAAgB,EAAW,EAAE,CACxD,QAAQ,KAAK,kBAAkB,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,QAAgB,EAAW,EAAE;IACjE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,gBAAgB,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,wBAAwB,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1E,gEAAgE;IAChE,yEAAyE;IACzE,mEAAmE;IACnE,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,sEAAsE;AACtE,oEAAoE;AACpE,mEAAmE;AACnE,wEAAwE;AACxE,wEAAwE;AACxE,qEAAqE;AACrE,gEAAgE;AAChE,aAAa;AACb,EAAE;AACF,mEAAmE;AACnE,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,QAAmC,EAAU,EAAE;IACrF,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC9F,OAAO,uBAAuB,CAAC;IACnC,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packet-wire.d.ts","sourceRoot":"","sources":["../../src/core/packet-wire.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packet-wire.d.ts","sourceRoot":"","sources":["../../src/core/packet-wire.js"],"names":[],"mappings":"AAsBO,yDAYN;AAOM,qDAgBN;AAIM;;;IAGN"}
|
package/dist/core/packet-wire.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// Section headers follow the `# Plurnk System X` convention so the model
|
|
12
12
|
// sees consistent framing across every section it might receive. Sections
|
|
13
13
|
// with no content are omitted entirely (no empty headers in the wire).
|
|
14
|
+
import { isLineNavigableMimetype } from "./mimetype-binary.js";
|
|
14
15
|
// Render packet.system → system message content (markdown string).
|
|
15
16
|
// {system_definition verbatim}
|
|
16
17
|
// # Plurnk System Instructions (persona)
|
|
@@ -36,7 +37,9 @@ export const renderSystemContent = (system) => {
|
|
|
36
37
|
// # Plurnk System Requirements (per-turn rules incl. Turn N/M marker)
|
|
37
38
|
export const renderUserContent = (user) => {
|
|
38
39
|
const parts = [];
|
|
39
|
-
|
|
40
|
+
if (typeof user.prompt === "string" && user.prompt.length > 0) {
|
|
41
|
+
parts.push(`# Plurnk System User Prompt\n\n${user.prompt}`);
|
|
42
|
+
}
|
|
40
43
|
const telemetry = user.telemetry ?? { budget: "", errors: [] };
|
|
41
44
|
if (typeof telemetry.budget === "string" && telemetry.budget.length > 0) {
|
|
42
45
|
parts.push(`# Plurnk System Budget\n\n${telemetry.budget}`);
|
|
@@ -55,46 +58,184 @@ export const packetToWireMessages = (packet) => [
|
|
|
55
58
|
{ role: "system", content: renderSystemContent(packet.system) },
|
|
56
59
|
{ role: "user", content: renderUserContent(packet.user) },
|
|
57
60
|
];
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
+
// Number each line of body as `<N>:\t<line>` — mirrors rummy
|
|
62
|
+
// plugins/helpers.js numberLines. The leading digit prevents column-zero
|
|
63
|
+
// fence collisions and gives the model line refs for free (`READ<42-46>`).
|
|
64
|
+
const numberLines = (body, start = 1) => {
|
|
65
|
+
if (!body)
|
|
66
|
+
return "";
|
|
67
|
+
const trailingNewline = body.endsWith("\n");
|
|
68
|
+
const source = trailingNewline ? body.slice(0, -1) : body;
|
|
69
|
+
const numbered = source.split("\n").map((line, i) => `${start + i}:\t${line}`).join("\n");
|
|
70
|
+
return trailingNewline ? `${numbered}\n` : numbered;
|
|
71
|
+
};
|
|
72
|
+
// Tolerant JSON parser for log entries' rx/tx fields. The engine
|
|
73
|
+
// pre-parses application/json mimetypes, but render may also receive
|
|
74
|
+
// strings (legacy paths, manual tests). Returns null on parse failure.
|
|
75
|
+
const safeParse = (s) => {
|
|
76
|
+
try {
|
|
77
|
+
return JSON.parse(s);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
// Stable JSON: keys sorted alphabetically so the same meta produces the
|
|
84
|
+
// same string across turns — prefix-cache friendly. Mirrors rummy
|
|
85
|
+
// plugins/helpers.js canonicalJson.
|
|
86
|
+
const canonicalJson = (obj) => {
|
|
87
|
+
const keys = Object.keys(obj).sort();
|
|
88
|
+
const sorted = {};
|
|
89
|
+
for (const k of keys)
|
|
90
|
+
sorted[k] = obj[k];
|
|
91
|
+
return JSON.stringify(sorted);
|
|
92
|
+
};
|
|
93
|
+
// Heredoc block for one channel of one entry. Fence is `URI#channel`
|
|
94
|
+
// (plurnk-grammar-native form) so model emissions and entry projections
|
|
95
|
+
// share one syntax. When `channel` is null/empty the fence is path-only —
|
|
96
|
+
// this is the default-channel convention: the absence of `#channel` is
|
|
97
|
+
// the addressing of the scheme's default channel, not a missing field.
|
|
98
|
+
// Body is line-numbered.
|
|
99
|
+
const renderHeredoc = (uri, channel, body) => {
|
|
100
|
+
const fence = channel ? `${uri}#${channel}` : uri;
|
|
101
|
+
const numbered = numberLines(body);
|
|
102
|
+
return `<<${fence}:\n${numbered}\n:${fence}`;
|
|
103
|
+
};
|
|
104
|
+
// Render a (scheme, pathname) tuple as the URI the model should SEE.
|
|
105
|
+
// Null scheme → bare pathname. The `file` scheme never reaches this
|
|
106
|
+
// function because Engine.#extractTarget normalizes it to null at the
|
|
107
|
+
// storage boundary; storage and wire output are uniform on this.
|
|
108
|
+
const renderModelUri = (scheme, pathname) => {
|
|
109
|
+
const path = pathname ?? "";
|
|
110
|
+
if (scheme === null || scheme === undefined)
|
|
111
|
+
return path;
|
|
112
|
+
return `${scheme}://${path}`;
|
|
113
|
+
};
|
|
114
|
+
// Render one Index entry → `* {meta}` line followed by per-channel
|
|
115
|
+
// heredoc blocks. meta describes the entry; nested `channels` carries
|
|
116
|
+
// per-channel mimetype/tokens so the model doesn't have to READ to
|
|
117
|
+
// learn the shape of a channel's content.
|
|
61
118
|
const renderIndexEntries = (entries) => entries.map((e) => {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
119
|
+
const uri = renderModelUri(e.scheme, e.pathname);
|
|
120
|
+
const defaultChannel = e.defaultChannel ?? "";
|
|
121
|
+
const meta = { path: uri };
|
|
122
|
+
if (Array.isArray(e.tags) && e.tags.length > 0)
|
|
123
|
+
meta.tags = e.tags;
|
|
124
|
+
const channelsMeta = {};
|
|
125
|
+
const blocks = [];
|
|
126
|
+
for (const [channelName, ch] of Object.entries(e.channels ?? {})) {
|
|
127
|
+
const content = ch?.content;
|
|
128
|
+
if (typeof content !== "string")
|
|
129
|
+
continue;
|
|
130
|
+
const channelInfo = {};
|
|
131
|
+
if (typeof ch.mimetype === "string")
|
|
132
|
+
channelInfo.mimetype = ch.mimetype;
|
|
133
|
+
if (typeof ch.tokens === "number")
|
|
134
|
+
channelInfo.tokens = ch.tokens;
|
|
135
|
+
channelsMeta[channelName] = channelInfo;
|
|
136
|
+
const fenceChannel = channelName === defaultChannel ? null : channelName;
|
|
137
|
+
blocks.push(renderHeredoc(uri, fenceChannel, content));
|
|
71
138
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
139
|
+
if (Object.keys(channelsMeta).length > 0)
|
|
140
|
+
meta.channels = channelsMeta;
|
|
141
|
+
return blocks.length > 0
|
|
142
|
+
? `* ${canonicalJson(meta)}\n${blocks.join("\n")}`
|
|
143
|
+
: `* ${canonicalJson(meta)}`;
|
|
75
144
|
}).join("\n\n");
|
|
76
|
-
// Render one Log entry →
|
|
77
|
-
//
|
|
145
|
+
// Render one Log entry → a single bullet line carrying the meta JSON.
|
|
146
|
+
// No body, no fence — every meaningful field is in the JSON. Naming
|
|
147
|
+
// follows the uniform principle: `path` is identity (this log row's
|
|
148
|
+
// own URI), `target` is the URI the action acted on. COPY/MOVE add
|
|
149
|
+
// `source`; currently the engine emits target only (source plumbing
|
|
150
|
+
// pending the COPY/MOVE-specific log shape pass).
|
|
151
|
+
//
|
|
152
|
+
// On error, status >= 400 signals the failure; the message lives in
|
|
153
|
+
// the next packet's user.telemetry.errors[] per SPEC §15.1. (Forward:
|
|
154
|
+
// meta will gain tokensBefore/After + linesBefore/After to convey
|
|
155
|
+
// change scope without carrying the body content.)
|
|
156
|
+
// Per-entry render: one meta JSON line + optionally a body block for
|
|
157
|
+
// ops whose response IS the content the model needs to see. READ is
|
|
158
|
+
// the canonical case — its rx carries the file/entry content the
|
|
159
|
+
// model asked for, and the model can't act on what it can't see. The
|
|
160
|
+
// body block uses the heredoc fence form so it parses the same as
|
|
161
|
+
// index entries (model already knows the shape).
|
|
78
162
|
const renderLogEntries = (entries) => entries.map((e) => {
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
163
|
+
const meta = {};
|
|
164
|
+
const coordinate = typeof e.coordinate === "string" ? e.coordinate : null;
|
|
165
|
+
const op = typeof e.op === "string" && e.op.length > 0 ? e.op : null;
|
|
166
|
+
if (coordinate !== null && op !== null)
|
|
167
|
+
meta.path = `log://${coordinate}/${op}`;
|
|
168
|
+
else if (coordinate !== null)
|
|
169
|
+
meta.path = `log://${coordinate}`;
|
|
170
|
+
if (typeof e.origin === "string")
|
|
171
|
+
meta.origin = e.origin;
|
|
172
|
+
if (op !== null)
|
|
173
|
+
meta.op = op;
|
|
174
|
+
if (typeof e.status === "number")
|
|
175
|
+
meta.status = e.status;
|
|
176
|
+
const target = renderActionTarget(e.target);
|
|
177
|
+
if (target !== null)
|
|
178
|
+
meta.target = target;
|
|
179
|
+
// Op-specific meta enrichment for READ: surface the matcher body
|
|
180
|
+
// and match count when a body matcher was used. Without these, the
|
|
181
|
+
// model can't distinguish "0 matches" from "empty content" — both
|
|
182
|
+
// would render as a status-204 line. The matcher comes from the
|
|
183
|
+
// stored statement (tx); the count from the result (rx).
|
|
184
|
+
if (op === "READ") {
|
|
185
|
+
const tx = e.tx;
|
|
186
|
+
if (tx !== null && typeof tx === "object" && tx.body !== null && typeof tx.body === "object") {
|
|
187
|
+
if (typeof tx.body.raw === "string")
|
|
188
|
+
meta.matcher = tx.body.raw;
|
|
189
|
+
}
|
|
190
|
+
const rx = typeof e.rx === "string" ? safeParse(e.rx) : e.rx;
|
|
191
|
+
if (rx !== null && typeof rx === "object" && typeof rx.matches === "number") {
|
|
192
|
+
meta.matches = rx.matches;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const metaLine = `* ${canonicalJson(meta)}`;
|
|
196
|
+
// READ@200: expose the response body. READ@204 (successfully empty —
|
|
197
|
+
// 0 matcher hits, sentinel slice, or empty source) has no body to
|
|
198
|
+
// render; the meta line carries the signal via `matches` / status code.
|
|
199
|
+
// EDIT@200/201: surface the unified diff so the model sees what
|
|
200
|
+
// changed without an explicit follow-up READ. Catches wrong-marker
|
|
201
|
+
// mistakes on the next turn (M.12).
|
|
202
|
+
if (op === "EDIT" && (e.status === 200 || e.status === 201)) {
|
|
203
|
+
const rx = typeof e.rx === "string" ? safeParse(e.rx) : e.rx;
|
|
204
|
+
if (rx !== null && typeof rx === "object" && typeof rx.diff === "string" && rx.diff.length > 0) {
|
|
205
|
+
const fence = target ?? `log://${coordinate}`;
|
|
206
|
+
return `${metaLine}\n<<${fence}:\n${rx.diff}\n:${fence}`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (op === "READ" && e.status === 200) {
|
|
210
|
+
const rx = typeof e.rx === "string" ? safeParse(e.rx) : e.rx;
|
|
211
|
+
if (rx !== null && typeof rx === "object" && typeof rx.content === "string" && rx.content.length > 0) {
|
|
212
|
+
const fence = target ?? `log://${coordinate}`;
|
|
213
|
+
// Line-navigable mimetypes (text/markdown, text/plain,
|
|
214
|
+
// source code, etc.) get N:\t prefix per plurnk.md. Tree-
|
|
215
|
+
// navigable (JSON, XML, HTML) render verbatim — line
|
|
216
|
+
// numbers in the wrapper would collide with structural
|
|
217
|
+
// navigation (jsonpath/xpath) used on these formats.
|
|
218
|
+
// Classifier is consumer-side in this repo (see AGENTS.md
|
|
219
|
+
// "Matcher return semantics rework" / plurnk-grammar#17).
|
|
220
|
+
const mimetype = typeof rx.mimetype === "string" ? rx.mimetype : "text/plain";
|
|
221
|
+
if (isLineNavigableMimetype(mimetype)) {
|
|
222
|
+
const start = typeof rx.startLine === "number" ? rx.startLine : 1;
|
|
223
|
+
return `${metaLine}\n<<${fence}:\n${numberLines(rx.content, start)}\n:${fence}`;
|
|
224
|
+
}
|
|
225
|
+
return `${metaLine}\n<<${fence}:\n${rx.content}\n:${fence}`;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return metaLine;
|
|
229
|
+
}).join("\n");
|
|
230
|
+
const renderActionTarget = (target) => {
|
|
87
231
|
if (target === null || target === undefined)
|
|
88
|
-
return
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
if (scheme !== null && scheme !== undefined)
|
|
92
|
-
return `${scheme}://${pathname}`;
|
|
93
|
-
return pathname.length > 0 ? pathname : "—";
|
|
232
|
+
return null;
|
|
233
|
+
const rendered = renderModelUri(target.scheme, target.pathname);
|
|
234
|
+
return rendered.length > 0 ? rendered : null;
|
|
94
235
|
};
|
|
95
236
|
// Render TelemetryError[] → bullet list. v0 schema is open per Packet.json
|
|
96
237
|
// ("Inner shapes intentionally open at v0; consumers populate as needs
|
|
97
238
|
// solidify"), so this just emits each error as a JSON line until the
|
|
98
239
|
// shape settles.
|
|
99
|
-
const renderTelemetryErrors = (errors) => errors.map((e) =>
|
|
240
|
+
const renderTelemetryErrors = (errors) => errors.map((e) => `* ${canonicalJson(e)}`).join("\n");
|
|
100
241
|
//# sourceMappingURL=packet-wire.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packet-wire.js","sourceRoot":"","sources":["../../src/core/packet-wire.js"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,0EAA0E;AAC1E,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,qEAAqE;AACrE,8CAA8C;AAE9C,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AAEvE,mEAAmE;AACnE,iCAAiC;AACjC,6CAA6C;AAC7C,iEAAiE;AACjE,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,EAAE;IAC1C,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACzC,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,KAAK,CAAC,IAAI,CAAC,mCAAmC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,4BAA4B,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CA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