@plurnk/plurnk-contracts 7.2.1 → 7.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/.env.defaults +8 -7
- package/README.md +4 -3
- package/SPEC.md +65 -73
- package/dist/schema/CapabilityDescriptor.json +3 -3
- package/dist/schema/CapabilitySelector.json +3 -3
- package/dist/schema/FunctionalityDefinitionState.json +1 -1
- package/dist/schema/MatcherBody.json +3 -3
- package/dist/schema/McpServerDefinition.json +1 -1
- package/dist/schema/Notice.json +1 -1
- package/dist/schema/PlurnkStatement.json +77 -86
- package/dist/schema/ProposalProjection.json +15 -16
- package/dist/schema/ResourceSelection.json +6 -6
- package/dist/schema/SendBody.json +1 -1
- package/dist/src/Application.d.ts +28 -6
- package/dist/src/Application.d.ts.map +1 -1
- package/dist/src/Application.js +159 -9
- package/dist/src/Application.js.map +1 -1
- package/dist/src/ApplicationNotifications.d.ts +135 -2
- package/dist/src/ApplicationNotifications.d.ts.map +1 -1
- package/dist/src/ApplicationNotifications.js +95 -1
- package/dist/src/ApplicationNotifications.js.map +1 -1
- package/dist/src/ApplicationPort.d.ts +2 -1
- package/dist/src/ApplicationPort.d.ts.map +1 -1
- package/dist/src/ApplicationPort.js.map +1 -1
- package/dist/src/ApplicationStream.d.ts +1 -3
- package/dist/src/ApplicationStream.d.ts.map +1 -1
- package/dist/src/ApplicationStream.js.map +1 -1
- package/dist/src/CapabilityAdmission.js.map +1 -1
- package/dist/src/Excerpt.js.map +1 -1
- package/dist/src/Functionality.js.map +1 -1
- package/dist/src/HttpOrigin.d.ts +27 -0
- package/dist/src/HttpOrigin.d.ts.map +1 -1
- package/dist/src/HttpOrigin.js +69 -0
- package/dist/src/HttpOrigin.js.map +1 -1
- package/dist/src/JsonDocument.js.map +1 -1
- package/dist/src/JsonResult.js.map +1 -1
- package/dist/src/LogRow.d.ts +1 -1
- package/dist/src/LogRow.d.ts.map +1 -1
- package/dist/src/LogRow.js +13 -15
- package/dist/src/LogRow.js.map +1 -1
- package/dist/src/LoopLifecycle.js.map +1 -1
- package/dist/src/MessageResource.js.map +1 -1
- package/dist/src/PathSyntax.js.map +1 -1
- package/dist/src/PlurnkParseError.js.map +1 -1
- package/dist/src/Problems.js.map +1 -1
- package/dist/src/TurnDisposition.js +1 -1
- package/dist/src/TurnDisposition.js.map +1 -1
- package/dist/src/Validator.js.map +1 -1
- package/dist/src/guards.js.map +1 -1
- package/dist/src/index.d.ts +4 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +1 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.generated.d.ts +79 -79
- package/dist/src/types.generated.d.ts.map +1 -1
- package/dist/src/types.generated.js.map +1 -1
- package/dist/src/types.js +5 -7
- package/dist/src/types.js.map +1 -1
- package/package.json +3 -3
- package/plurnk.md +4 -165
- package/dist/src/TodoItems.d.ts +0 -6
- package/dist/src/TodoItems.d.ts.map +0 -1
- package/dist/src/TodoItems.js +0 -145
- package/dist/src/TodoItems.js.map +0 -1
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oFAAoF;AACpF,cAAc,sBAAsB,CAAC;AAErC,OAAO,oBAAoB,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvF,OAAO,YAAY,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvE,OAAO,qBAAqB,MAAM,gCAAgC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAUzF,0EAA0E;AAC1E,6CAA6C;AAE7C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAA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IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAiD,SAAY,EAAoD,EAAE,CAC1I,SAAS,IAAI,SAAS,CAAC;AAC3B,+FAA+F;AAC/F,kBAAkB;AAClB,MAAM,CAAC,MAAM,SAAS,GAAG,CAA4B,SAAY,EAA4C,EAAE;AAC3G,8IAA8I;AAC9I,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAA6C,CAAC;AAmB5G,2EAA2E;AAC3E,uEAAuE;AACvE,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM;AAChC,2HAA2H;AAC3H,YAAY,CAAC,IAAgB,CAChC,CAAC;AAEF,sEAAsE;AACtE,+BAA+B;AAC/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM;AAC1C,2HAA2H;AAC3H,oBAAoB,CAAC,IAAwB,CAChD,CAAC;AAEF,wFAAwF;AACxF,MAAM,CAAC,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAE/D,wFAAwF;AACxF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAEpF,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAuB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAE1F,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC","sourcesContent":["// Schema-derived types are generated from schema/*.json — re-exported here as\n// the single import surface for consumers. Run `npm run build:types` to regenerate.\nexport * from \"./types.generated.ts\";\n\nimport proposalPolicySchema from \"../schema/ProposalPolicy.json\" with { type: \"json\" };\nimport effortSchema from \"../schema/Effort.json\" with { type: \"json\" };\nimport skillDefinitionSchema from \"../schema/SkillDefinition.json\" with { type: \"json\" };\nimport type {\n ProposalPolicy,\n Position,\n PlurnkStatement,\n ProviderRequestAccounting,\n Effort,\n} from \"./types.generated.ts\";\nimport type PlurnkParseError from \"./PlurnkParseError.ts\";\n\n// Non-schema types — depend on the PlurnkParseError class and so can't be\n// expressed in JSON Schema. Hand-maintained.\n\n// Runtime protocol alphabet; PlurnkOp is structurally derived from this tuple. {§op-shapes}\nexport const PLURNK_OPS = [\n \"find\", \"read\", \"edit\", \"copy\", \"move\", \"send\", \"done\", \"fail\", \"bare\", \"work\", \"fork\", \"kill\",\n \"note\", \"wait\",\n] as const;\n\nexport type PlurnkOp = (typeof PLURNK_OPS)[number];\n\n// Membership in the operation alphabet: the one test an operation name or a stored row's op is read through.\nexport const isPlurnkOp = (value: unknown): value is PlurnkOp => PLURNK_OPS.some((op) => op === value);\n\n// An execution's operation IS the runtime tag: lowercase by {§executor-discovery},\n// disjoint from core operation keywords (`PLURNK_OPS`) and reserved row ops (`extension`, `error`).\nexport type RuntimeTag = Lowercase<string>;\nexport const RUNTIME_TAG = /^[a-z][a-z0-9+._-]*$/;\nexport const INTERNAL_ROW_OPS: ReadonlySet<string> = new Set([\"extension\", \"error\"]);\nexport const isExecutionOp = (op: string | null | undefined): op is RuntimeTag =>\n typeof op === \"string\" && !INTERNAL_ROW_OPS.has(op) && !isPlurnkOp(op) && RUNTIME_TAG.test(op);\nexport const isExecution = <T extends { readonly op?: string | undefined }>(statement: T): statement is Extract<T, { runtime: RuntimeTag }> =>\n \"runtime\" in statement;\n// The operation token as written: an operation keyword, or an execution's runtime. This is the\n// log row's `op`.\nexport const writtenOp = <T extends PlurnkStatement>(statement: T): Exclude<T[\"op\"], undefined> | RuntimeTag =>\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- an execution's op is its runtime tag; every other statement's op is its own\n (isExecution(statement) ? statement.runtime : statement.op) as Exclude<T[\"op\"], undefined> | RuntimeTag;\n\n// Runtime-neutral cardinal observation for one physical inference request.\n// The caller opens identity before I/O; the producer settles that exact\n// occurrence once with normalized accounting evidence. {§provider-request-accounting}\nexport interface ProviderRequestIdentity {\n readonly provider: string;\n readonly model: string;\n}\n\nexport type ProviderRequestSettlement = (\n accounting: ProviderRequestAccounting,\n evidence?: unknown,\n) => Promise<void>;\n\nexport type ProviderRequestObserver = (\n identity: ProviderRequestIdentity,\n) => Promise<ProviderRequestSettlement>;\n\n// Schema-owned portable reasoning vocabulary. Providers own which subset a\n// route supports; runtimes and clients share this exact wire alphabet.\nexport const EFFORTS = Object.freeze(\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the enum and the type are generated from the same schema\n effortSchema.enum as Effort[],\n);\n\n// Schema-owned server disposition vocabulary. {§proposal-disposition}\n// {§capability-policy-cascade}\nexport const PROPOSAL_POLICIES = Object.freeze(\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the enum and the type are generated from the same schema\n proposalPolicySchema.enum as ProposalPolicy[],\n);\n\n// Minting predicate only; URL ingestion deliberately remains permissive. {§path-syntax}\nexport const SESSION_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;\n\n// {§agent-skills-directory} Discovery and registration share the wire schema's grammar.\nexport const SKILL_NAME = new RegExp(skillDefinitionSchema.$defs.name.pattern, \"u\");\n\n// Structurally synthesized statements have no parsed source point. {§parse-recovery}\nexport const UNKNOWN_POSITION: Readonly<Position> = Object.freeze({ line: 0, column: 0 });\n\n// The platform's setTimeout ceiling (2^31-1 ms): the bound on any delay a knob may name.\nexport const MAX_TIMER_MS = 2_147_483_647;\n\n// {§parse-recovery} The statement a hard fact refused, as the session wrote it.\nexport interface ParseAttempt {\n readonly verb: string;\n readonly text: string;\n}\n\nexport type ParseItem =\n | { kind: \"statement\"; statement: PlurnkStatement }\n | { kind: \"text\"; content: string; position: Position }\n | { kind: \"error\"; error: PlurnkParseError; attempt?: ParseAttempt };\n\nexport type ParseResult = {\n items: ParseItem[];\n unparsedTail?: { from: Position; reason: string };\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plurnk/plurnk-contracts",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "Canonical PLURNK language contract, schemas, generated types, and runtime-neutral wire contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plurnk",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"homepage": "https://github.com/plurnk/plurnk-service/tree/main/plurnk-contracts#readme",
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://
|
|
12
|
+
"url": "https://github.com/plurnk/plurnk-service/issues"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"json-schema-to-typescript": "^16.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "49f92d9351021ae0729d69e72ab9b1b95e3a974b"
|
|
72
72
|
}
|
package/plurnk.md
CHANGED
|
@@ -1,166 +1,5 @@
|
|
|
1
|
-
# Plurnk
|
|
1
|
+
# Plurnk Session
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Syntax
|
|
7
|
-
|
|
8
|
-
```exampleOperation (path)? <scope|range>? [metadata]? pattern? <!-- aside -->?
|
|
9
|
-
body?
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
> [!TIP]
|
|
13
|
-
> You may use more than three backticks in your opening and closing outer fences to wrap, nest, and disambiguate.
|
|
14
|
-
|
|
15
|
-
## Core Operations
|
|
16
|
-
|
|
17
|
-
* NOTE: Working memory. Save all new facts and ideas for later turns.
|
|
18
|
-
* TODO: List of remaining TODO items (absent if finished).
|
|
19
|
-
* FIND: List matching paths, or the match locations inside one path.
|
|
20
|
-
* READ: Read files, entries, streams, or only the lines a pattern selects.
|
|
21
|
-
* EDIT: Create a file or entry; replace existing text by scope or by pattern.
|
|
22
|
-
* COPY (source) <scope>? (destination) <scope>?: Copy files, entries, streams, or text regions (no body).
|
|
23
|
-
* MOVE (source) <scope>? (destination) <scope>?: Move files, entries, streams, or text regions (no body).
|
|
24
|
-
* KILL: Delete an entry, stop a process, or retire log items.
|
|
25
|
-
* WORK: Delegate to a child session (fresh log).
|
|
26
|
-
* FORK: Delegate to a child session (copied log).
|
|
27
|
-
* WAIT: Yield to child sessions or streams. You may include `[60]` to check in after 60 seconds.
|
|
28
|
-
* SEND: Deliver a new message.
|
|
29
|
-
* DONE: Deliver the final deliverable message, concluding an Open Message (oldest when path omitted).
|
|
30
|
-
* FAIL: Deliver the final failure message, concluding an Open Message (oldest when path omitted).
|
|
31
|
-
|
|
32
|
-
## Loop Protocol
|
|
33
|
-
|
|
34
|
-
> [!IMPORTANT]
|
|
35
|
-
> YOU MUST persist all new facts and ideas and emit a TODO list.
|
|
36
|
-
|
|
37
|
-
```NOTE
|
|
38
|
-
a finding or conclusion and its evidence
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```TODO
|
|
42
|
-
- The first step.
|
|
43
|
-
- The second step.
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
````SEND
|
|
47
|
-
a continuing progress update response
|
|
48
|
-
````
|
|
49
|
-
|
|
50
|
-
````DONE
|
|
51
|
-
a final deliverable response
|
|
52
|
-
````
|
|
53
|
-
|
|
54
|
-
> [!TIP]
|
|
55
|
-
> The loop continues until all Open Work is resolved, with all Open Messages DONE or FAILed.
|
|
56
|
-
|
|
57
|
-
> [!TIP]
|
|
58
|
-
> YOU SHOULD NOT deliberate while discovering. Submit necessary NOTE, TODO, FIND and READ operations, then deliberate on the next turn.
|
|
59
|
-
|
|
60
|
-
## Delegation (plurnk:///delegation.md)
|
|
61
|
-
|
|
62
|
-
```WORK (session://exampleSessionName) <!-- the child's result lands in your log -->
|
|
63
|
-
Describe the child's complete task in the body.
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## `pattern` (plurnk:///pattern.md)
|
|
67
|
-
|
|
68
|
-
| prefix | dialect | example |
|
|
69
|
-
|--------|-----------------------------|---------------------------------|
|
|
70
|
-
| `/` | regex (ECMAScript) | `/\btimeout\b/i` |
|
|
71
|
-
| `//` | xpath (1.0) | `//dependencies/*` |
|
|
72
|
-
| `$` | jsonpath (RFC 9535) | `$.items[?(@.price>500)]` |
|
|
73
|
-
| `~` | full-text (SQLite FTS5) | `~retry` |
|
|
74
|
-
| `&` | graph (treesitter symbols) | `&sym`, `&<sym`, `&>sym` |
|
|
75
|
-
| none | literal or glob/extglob | `?(export )?(async )function *` |
|
|
76
|
-
|
|
77
|
-
> [!TIP]
|
|
78
|
-
> Patterns select source text as written, and an EDIT body replaces all of it:
|
|
79
|
-
> `//book/@lang` selects `lang="en"`;
|
|
80
|
-
> `$.lang` selects `"en"` with its quotes.
|
|
81
|
-
|
|
82
|
-
## `<scope|range>`
|
|
83
|
-
|
|
84
|
-
> [!TIP]
|
|
85
|
-
> Text scopes use 1-based lines and Unicode code-point columns across textual mimetypes.
|
|
86
|
-
|
|
87
|
-
| form | endpoint rule |
|
|
88
|
-
|-----------------|--------------------------------|
|
|
89
|
-
| `<L>`, `<@hash>` | one line |
|
|
90
|
-
| `<SL,EL>`, `<@start,@end>` | lines SL through EL, inclusive |
|
|
91
|
-
| `<SL,SC,EL,EC>` | start included, end excluded — `<@abcde,5,@abcde,8>` is `bar` in line 42 `foo bar baz` |
|
|
92
|
-
| `<L,1,L,1>`, `<@hash,1,@hash,1>` | insert before that line |
|
|
93
|
-
| `<0>`, `<-1>` | prepend / append on mutations; as an end line, `-1` is the last line |
|
|
94
|
-
|
|
95
|
-
## Workspace Navigation
|
|
96
|
-
|
|
97
|
-
```FIND (src/**/*.ts) <1,-1> /TODO/ <!-- paths with matches; the range pages results, not lines -->
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
```READ (src/**/*.ts) <1,-1> /TODO/ <!-- the matching lines in every file -->
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```COPY (sh:///ab3d5678) (build.log) <!-- the command's output lands in a file, never in your context -->
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
* `(path)` may be a glob/extglob, permitting bulk operations.
|
|
107
|
-
* Log item paths nest: `log:///1/2/3/READ` is loop/turn/item/OP.
|
|
108
|
-
* FIND results hold one inner array per path: its channels, default first; append `#channel` to the path to select another: `(sh:///ab3d5678#stderr)`.
|
|
109
|
-
* Percent-encode in paths `(` as `%28` and `)` as `%29`.
|
|
110
|
-
|
|
111
|
-
## Membership (mcp:///plurnk_members.md)
|
|
112
|
-
|
|
113
|
-
```plurnk_members (add) <!-- adding membership tracking for files outside of the project folder -->
|
|
114
|
-
{"files": ["../exampleSisterProject/*.md", "../exampleSisterProject/example.json"]}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Editing
|
|
118
|
-
|
|
119
|
-
````EDIT (example.md) <@abcde> <!-- READ showed 42<@abcde>foo bar baz; the body replaces line 42 -->
|
|
120
|
-
bar
|
|
121
|
-
````
|
|
122
|
-
|
|
123
|
-
````EDIT (example.md) <@abcde,@fghij> <!-- the body replaces lines 42 through 43 -->
|
|
124
|
-
bar
|
|
125
|
-
````
|
|
126
|
-
|
|
127
|
-
````EDIT (example.md) <@abcde,5,@abcde,8> <!-- READ showed 42<@abcde>foo bar baz; "bar" becomes the body -->
|
|
128
|
-
qux
|
|
129
|
-
````
|
|
130
|
-
|
|
131
|
-
````EDIT (example.md) <@abcde,1,@abcde,1> <!-- insert before line 42; line 42 stays -->
|
|
132
|
-
baz
|
|
133
|
-
````
|
|
134
|
-
|
|
135
|
-
````EDIT (example.md) <@fghij,1,@fghij,1> <!-- insert after line 42: insert before line 43; insert after the last line: <-1> -->
|
|
136
|
-
qux
|
|
137
|
-
````
|
|
138
|
-
|
|
139
|
-
````EDIT (src/**/*.js) /\bfoo\b/ <!-- every match in every file becomes the body -->
|
|
140
|
-
bar
|
|
141
|
-
````
|
|
142
|
-
|
|
143
|
-
````EDIT (books.xml) //book[price > 35.00] <!-- an empty body removes each match -->
|
|
144
|
-
````
|
|
145
|
-
|
|
146
|
-
> [!TIP]
|
|
147
|
-
> YOU SHOULD address lines with batch-friendly `<@hash>` or `<@start,@end>` anchors to protect against stale targets.
|
|
148
|
-
|
|
149
|
-
## Context Curation
|
|
150
|
-
|
|
151
|
-
```READ (largeExampleFile.txt) <101,200> <!-- READing in chunks if budget constrained -->
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
```KILL (log:///1/[1-7]/*/{READ,emission}) <!-- old results, in bulk; the body may survive as a NOTE -->
|
|
155
|
-
example distillation or summarization
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Environment (mcp:///plurnk_env.md)
|
|
159
|
-
|
|
160
|
-
```plurnk_env (add) <!-- persists for this session's commands -->
|
|
161
|
-
{"alias":"PLANET","value":"world"}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
```sh <!-- greet the world -->
|
|
165
|
-
echo "Hello, $PLANET."
|
|
166
|
-
```
|
|
3
|
+
- YOU MUST ONLY submit unfenced tool calls: `<server>.<tool>({}) // aside`.
|
|
4
|
+
- YOU SHOULD take at least one `plurnk.note` each turn to record facts, ideas, and plans.
|
|
5
|
+
- YOU SHOULD prefer hash anchors or pattern replacement with `plurnk.edit` to avoid stale targets.
|
package/dist/src/TodoItems.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {§op-shapes} Extracts ordered step items from a `TODO` operation body, tolerating markdown bullets,
|
|
3
|
-
* numbered/lettered lists, checkboxes, JSON arrays/objects (including copied `## Open Work` JSON), and free text.
|
|
4
|
-
*/
|
|
5
|
-
export declare function parseTodoItems(body: string | null | undefined): string[];
|
|
6
|
-
//# sourceMappingURL=TodoItems.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TodoItems.d.ts","sourceRoot":"","sources":["../../src/TodoItems.ts"],"names":[],"mappings":"AAwHA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CASxE"}
|
package/dist/src/TodoItems.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "./guards.js";
|
|
2
|
-
const COMPLETED_LINE_PREFIX = /^(?:(?:[-*+•]|(?:\d+|[A-Za-z])[.)])\s+)?\[(?:[xX]|done|DONE|completed|COMPLETED)\](?:\s+|$)/u;
|
|
3
|
-
const LIST_PREFIX = /^(?:(?:[-*+•]|(?:\d+|[A-Za-z])[.)])\s+(?:\[\s*\]\s+)?|\[\s*\]\s+|[-*+•]\s*$)/u;
|
|
4
|
-
const ITEM_KEYS = ["content", "text", "title", "item", "todo", "description", "name"];
|
|
5
|
-
const CONTAINER_KEYS = ["todo", "todos", "items", "steps", "tasks"];
|
|
6
|
-
const OPEN_WORK_KEYS = new Set(["sessions", "streams", "messages", "todo"]);
|
|
7
|
-
function extractCleanItem(raw) {
|
|
8
|
-
const trimmed = raw.trim();
|
|
9
|
-
if (trimmed.length === 0 || COMPLETED_LINE_PREFIX.test(trimmed))
|
|
10
|
-
return null;
|
|
11
|
-
const cleaned = trimmed.replace(LIST_PREFIX, "").trim();
|
|
12
|
-
return cleaned.length > 0 && !COMPLETED_LINE_PREFIX.test(cleaned) ? cleaned : null;
|
|
13
|
-
}
|
|
14
|
-
function isCompletedRecord(record) {
|
|
15
|
-
if (record.done === true || record.completed === true)
|
|
16
|
-
return true;
|
|
17
|
-
if (typeof record.status === "string") {
|
|
18
|
-
const lower = record.status.toLowerCase();
|
|
19
|
-
if (lower === "completed" || lower === "done")
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
function tryParseJson(raw) {
|
|
25
|
-
const trimmed = raw.trim().replace(/,\s*$/u, "");
|
|
26
|
-
if (trimmed.length === 0)
|
|
27
|
-
return undefined;
|
|
28
|
-
if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
|
|
29
|
-
try {
|
|
30
|
-
return JSON.parse(trimmed);
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (/^(?:"(?:todo|todos|items|steps|tasks)"|todo|todos|items|steps|tasks)\s*:/iu.test(trimmed)) {
|
|
37
|
-
const normalized = trimmed.replace(/^([A-Za-z]+)\s*:/u, '"$1":');
|
|
38
|
-
try {
|
|
39
|
-
return JSON.parse(`{${normalized}}`);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
function extractFromJsonValue(value) {
|
|
48
|
-
if (typeof value === "string") {
|
|
49
|
-
return parseLines(value);
|
|
50
|
-
}
|
|
51
|
-
if (Array.isArray(value)) {
|
|
52
|
-
const out = [];
|
|
53
|
-
for (const element of value) {
|
|
54
|
-
if (typeof element === "string") {
|
|
55
|
-
const cleaned = extractCleanItem(element);
|
|
56
|
-
if (cleaned !== null)
|
|
57
|
-
out.push(cleaned);
|
|
58
|
-
}
|
|
59
|
-
else if (isRecord(element)) {
|
|
60
|
-
if (isCompletedRecord(element))
|
|
61
|
-
continue;
|
|
62
|
-
let matched = false;
|
|
63
|
-
for (const key of ITEM_KEYS) {
|
|
64
|
-
const candidate = element[key];
|
|
65
|
-
if (typeof candidate === "string") {
|
|
66
|
-
const cleaned = extractCleanItem(candidate);
|
|
67
|
-
if (cleaned !== null)
|
|
68
|
-
out.push(cleaned);
|
|
69
|
-
matched = true;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (!matched) {
|
|
74
|
-
out.push(...extractFromJsonValue(element));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return out;
|
|
79
|
-
}
|
|
80
|
-
if (isRecord(value)) {
|
|
81
|
-
for (const key of CONTAINER_KEYS) {
|
|
82
|
-
if (key in value) {
|
|
83
|
-
return extractFromJsonValue(value[key]);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const entries = Object.entries(value).filter(([k]) => !OPEN_WORK_KEYS.has(k));
|
|
87
|
-
if (entries.length === 0)
|
|
88
|
-
return [];
|
|
89
|
-
const out = [];
|
|
90
|
-
for (const [key, entryValue] of entries) {
|
|
91
|
-
if (typeof entryValue === "string") {
|
|
92
|
-
const cleaned = extractCleanItem(entryValue);
|
|
93
|
-
if (cleaned !== null)
|
|
94
|
-
out.push(cleaned);
|
|
95
|
-
}
|
|
96
|
-
else if (typeof entryValue === "boolean" || entryValue === null) {
|
|
97
|
-
if (entryValue !== false) {
|
|
98
|
-
const cleaned = extractCleanItem(key);
|
|
99
|
-
if (cleaned !== null)
|
|
100
|
-
out.push(cleaned);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else if (Array.isArray(entryValue) || isRecord(entryValue)) {
|
|
104
|
-
out.push(...extractFromJsonValue(entryValue));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return out;
|
|
108
|
-
}
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
function parseLines(text) {
|
|
112
|
-
const out = [];
|
|
113
|
-
for (const rawLine of text.split(/\r?\n/u)) {
|
|
114
|
-
const trimmed = rawLine.trim();
|
|
115
|
-
if (trimmed.length === 0)
|
|
116
|
-
continue;
|
|
117
|
-
const parsedLine = tryParseJson(trimmed);
|
|
118
|
-
if (parsedLine !== undefined) {
|
|
119
|
-
out.push(...extractFromJsonValue(parsedLine));
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
const cleaned = extractCleanItem(trimmed);
|
|
123
|
-
if (cleaned !== null) {
|
|
124
|
-
out.push(cleaned);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return out;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* {§op-shapes} Extracts ordered step items from a `TODO` operation body, tolerating markdown bullets,
|
|
131
|
-
* numbered/lettered lists, checkboxes, JSON arrays/objects (including copied `## Open Work` JSON), and free text.
|
|
132
|
-
*/
|
|
133
|
-
export function parseTodoItems(body) {
|
|
134
|
-
if (typeof body !== "string")
|
|
135
|
-
return [];
|
|
136
|
-
const trimmed = body.trim();
|
|
137
|
-
if (trimmed.length === 0)
|
|
138
|
-
return [];
|
|
139
|
-
const parsedWhole = tryParseJson(trimmed);
|
|
140
|
-
if (parsedWhole !== undefined) {
|
|
141
|
-
return extractFromJsonValue(parsedWhole);
|
|
142
|
-
}
|
|
143
|
-
return parseLines(trimmed);
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=TodoItems.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TodoItems.js","sourceRoot":"","sources":["../../src/TodoItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,qBAAqB,GACvB,8FAA8F,CAAC;AACnG,MAAM,WAAW,GAAG,+EAA+E,CAAC;AACpG,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAU,CAAC;AAC/F,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAC7E,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjG,SAAS,gBAAgB,CAAC,GAAW;IACjC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,O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