pi.lock 0.0.0-stage → 0.1.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.
Files changed (49) hide show
  1. package/README.md +183 -2
  2. package/dist/bridge.d.ts +7 -0
  3. package/dist/bridge.js +18 -0
  4. package/dist/bridge.js.map +1 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +82 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands.d.ts +1 -0
  9. package/dist/commands.js +114 -0
  10. package/dist/commands.js.map +1 -0
  11. package/dist/common.d.ts +17 -0
  12. package/dist/common.js +87 -0
  13. package/dist/common.js.map +1 -0
  14. package/dist/definition.d.ts +32 -0
  15. package/dist/definition.js +379 -0
  16. package/dist/definition.js.map +1 -0
  17. package/dist/index.d.ts +5 -0
  18. package/dist/index.js +5 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/init.d.ts +6 -0
  21. package/dist/init.js +39 -0
  22. package/dist/init.js.map +1 -0
  23. package/dist/loader.d.ts +48 -0
  24. package/dist/loader.js +141 -0
  25. package/dist/loader.js.map +1 -0
  26. package/dist/lock.d.ts +17 -0
  27. package/dist/lock.js +92 -0
  28. package/dist/lock.js.map +1 -0
  29. package/dist/mcp.d.ts +8 -0
  30. package/dist/mcp.js +113 -0
  31. package/dist/mcp.js.map +1 -0
  32. package/dist/model.d.ts +14 -0
  33. package/dist/model.js +74 -0
  34. package/dist/model.js.map +1 -0
  35. package/dist/runtime.d.ts +37 -0
  36. package/dist/runtime.js +258 -0
  37. package/dist/runtime.js.map +1 -0
  38. package/docs/acceptance.md +54 -0
  39. package/docs/acceptance.tap +178 -0
  40. package/docs/architecture.md +47 -0
  41. package/examples/demo/.pi/SYSTEM.md +1 -0
  42. package/examples/demo/.pi/extensions/demo.ts +13 -0
  43. package/examples/demo/.pi/models.json +26 -0
  44. package/examples/demo/.pi/prompts/hello.md +4 -0
  45. package/examples/demo/.pi/settings.json +15 -0
  46. package/examples/demo/.pi/skills/explain/SKILL.md +5 -0
  47. package/examples/demo/pi.lock +473 -0
  48. package/npm-shrinkwrap.json +1880 -0
  49. package/package.json +46 -4
@@ -0,0 +1,473 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "runtime": {
4
+ "pi": "1.3.0",
5
+ "adapter": "0.1.0",
6
+ "sha256": "adf410a00f47a3894303def65e2a52cf8cc37c534f3dfc7e6529a0cc4b536df8"
7
+ },
8
+ "definition": {
9
+ "settings": {
10
+ "defaultProvider": "pi-lock-demo",
11
+ "defaultModel": "demo",
12
+ "defaultThinkingLevel": "off",
13
+ "defaultTools": [
14
+ "read",
15
+ "echo"
16
+ ],
17
+ "compaction": {
18
+ "enabled": false
19
+ },
20
+ "retry": {
21
+ "enabled": false
22
+ }
23
+ },
24
+ "files": [
25
+ {
26
+ "path": ".pi/extensions/demo.ts",
27
+ "sha256": "2d7af6513d03fe2740a6148d385c28bc245cd91ffc503f9d22b215366ec10751",
28
+ "executable": false
29
+ },
30
+ {
31
+ "path": ".pi/models.json",
32
+ "sha256": "e8e6a15e66c4d644bb2fb46a7d9db614be22fb7ade0f0197c3557b69e88f3ca8",
33
+ "executable": false
34
+ },
35
+ {
36
+ "path": ".pi/prompts/hello.md",
37
+ "sha256": "af67aab50b5f53235d5ae71e4ada3e3f23b36081cb672fa2c4f9df6d251493be",
38
+ "executable": false
39
+ },
40
+ {
41
+ "path": ".pi/settings.json",
42
+ "sha256": "25d7b018641e6f2d856b4e7aebae4253065d182220d2e29604d31ee10146acfa",
43
+ "executable": false
44
+ },
45
+ {
46
+ "path": ".pi/skills/explain/SKILL.md",
47
+ "sha256": "6a21691b008fe56dcfa9cd955add73029d32e1a49444187b076e2bf13a86c930",
48
+ "executable": false
49
+ },
50
+ {
51
+ "path": ".pi/SYSTEM.md",
52
+ "sha256": "1f0504434bd7be76fb93bfca2498c6fbe51e34b002e4d960cf2857a5c5f8b807",
53
+ "executable": false
54
+ }
55
+ ],
56
+ "resources": {
57
+ "extensions": [
58
+ ".pi/extensions/demo.ts"
59
+ ],
60
+ "skills": [
61
+ ".pi/skills/explain/SKILL.md"
62
+ ],
63
+ "prompts": [
64
+ ".pi/prompts/hello.md"
65
+ ],
66
+ "themes": [],
67
+ "context": [],
68
+ "system": ".pi/SYSTEM.md"
69
+ },
70
+ "dependencies": [],
71
+ "modelConfig": {
72
+ "providers": {
73
+ "pi-lock-demo": {
74
+ "api": "openai-completions",
75
+ "baseUrl": "http://localhost:0",
76
+ "models": [
77
+ {
78
+ "id": "demo",
79
+ "name": "Offline demo",
80
+ "reasoning": false,
81
+ "input": [
82
+ "text"
83
+ ],
84
+ "cost": {
85
+ "input": 0,
86
+ "output": 0,
87
+ "cacheRead": 0,
88
+ "cacheWrite": 0
89
+ },
90
+ "contextWindow": 32768,
91
+ "maxTokens": 1024
92
+ }
93
+ ]
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "model": {
99
+ "id": "demo",
100
+ "name": "Offline demo",
101
+ "reasoning": false,
102
+ "input": [
103
+ "text"
104
+ ],
105
+ "cost": {
106
+ "input": 0,
107
+ "output": 0,
108
+ "cacheRead": 0,
109
+ "cacheWrite": 0
110
+ },
111
+ "contextWindow": 32768,
112
+ "maxTokens": 1024,
113
+ "api": "openai-completions",
114
+ "provider": "pi-lock-demo",
115
+ "baseUrl": "http://localhost:0"
116
+ },
117
+ "agentDigest": "bf54f0845e5553fc6948add9a1711455feb5bc98d39eb40a9ade8cca00436827",
118
+ "effective": {
119
+ "model": {
120
+ "id": "demo",
121
+ "name": "Offline demo",
122
+ "reasoning": false,
123
+ "input": [
124
+ "text"
125
+ ],
126
+ "cost": {
127
+ "input": 0,
128
+ "output": 0,
129
+ "cacheRead": 0,
130
+ "cacheWrite": 0
131
+ },
132
+ "contextWindow": 32768,
133
+ "maxTokens": 1024,
134
+ "api": "openai-completions",
135
+ "provider": "pi-lock-demo",
136
+ "baseUrl": "http://localhost:0"
137
+ },
138
+ "thinkingLevel": "off",
139
+ "settings": {
140
+ "defaultProvider": "pi-lock-demo",
141
+ "defaultModel": "demo",
142
+ "defaultThinkingLevel": "off",
143
+ "defaultTools": [
144
+ "read",
145
+ "echo"
146
+ ],
147
+ "compaction": {
148
+ "enabled": false
149
+ },
150
+ "retry": {
151
+ "enabled": false
152
+ }
153
+ },
154
+ "extensions": [
155
+ {
156
+ "path": "<AGENT>/.pi/extensions/demo.ts",
157
+ "commands": [],
158
+ "hooks": []
159
+ }
160
+ ],
161
+ "skills": [
162
+ {
163
+ "name": "explain",
164
+ "description": "Explain the configured agent and its available tools.",
165
+ "filePath": "<AGENT>/.pi/skills/explain/SKILL.md",
166
+ "baseDir": "<AGENT>/.pi/skills/explain",
167
+ "sourceInfo": {
168
+ "path": "<AGENT>/.pi/skills/explain/SKILL.md",
169
+ "source": "pi.lock",
170
+ "scope": "project",
171
+ "origin": "top-level"
172
+ },
173
+ "disableModelInvocation": false
174
+ }
175
+ ],
176
+ "prompts": [
177
+ {
178
+ "name": "hello",
179
+ "description": "Try the same agent through every interface.",
180
+ "content": "Say hello using the echo tool. $ARGUMENTS",
181
+ "sourceInfo": {
182
+ "path": "<AGENT>/.pi/prompts/hello.md",
183
+ "source": "pi.lock",
184
+ "scope": "project",
185
+ "origin": "top-level"
186
+ },
187
+ "filePath": "<AGENT>/.pi/prompts/hello.md"
188
+ }
189
+ ],
190
+ "context": [],
191
+ "systemPrompt": "You are a helpful agent. Use the supplied tools and skills when needed.\n\n\n<skills>\nThe following skills provide specialized instructions for specific tasks.\nUse the read tool to load a skill's file when the task matches its description.\nWhen a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\n\n<available_skills>\n <skill>\n <name>explain</name>\n <description>Explain the configured agent and its available tools.</description>\n <location><AGENT>/.pi/skills/explain/SKILL.md</location>\n </skill>\n</available_skills>\n</skills>\n\n<cwd>\n<WORKSPACE>\n</cwd>",
192
+ "tools": [
193
+ {
194
+ "name": "read",
195
+ "description": "Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to 2000 lines or 50KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.",
196
+ "parameters": {
197
+ "type": "object",
198
+ "required": [
199
+ "path"
200
+ ],
201
+ "properties": {
202
+ "path": {
203
+ "type": "string",
204
+ "description": "Path to the file to read (relative or absolute)"
205
+ },
206
+ "offset": {
207
+ "type": "number",
208
+ "description": "Line number to start reading from (1-indexed)"
209
+ },
210
+ "limit": {
211
+ "type": "number",
212
+ "description": "Maximum number of lines to read"
213
+ }
214
+ }
215
+ },
216
+ "promptSnippet": "Read file contents",
217
+ "promptGuidelines": [
218
+ "Use read to examine files instead of cat or sed."
219
+ ],
220
+ "exposure": "direct",
221
+ "constrainedSampling": {
222
+ "type": "json_schema",
223
+ "strict": "prefer"
224
+ }
225
+ },
226
+ {
227
+ "name": "bash",
228
+ "description": "Execute a bash command in the current working directory. Returns stdout and stderr. Output is truncated to last 2000 lines or 50KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.",
229
+ "parameters": {
230
+ "type": "object",
231
+ "required": [
232
+ "command"
233
+ ],
234
+ "properties": {
235
+ "command": {
236
+ "type": "string",
237
+ "description": "Shell command to execute"
238
+ },
239
+ "timeout": {
240
+ "type": "number",
241
+ "description": "Timeout in seconds (optional, no default timeout)"
242
+ }
243
+ }
244
+ },
245
+ "promptSnippet": "Execute bash commands (ls, grep, find, etc.)",
246
+ "promptGuidelines": [
247
+ "You can inspect PI_* environment variables for current model and session details."
248
+ ],
249
+ "exposure": "direct",
250
+ "constrainedSampling": {
251
+ "type": "json_schema",
252
+ "strict": "prefer"
253
+ }
254
+ },
255
+ {
256
+ "name": "powershell",
257
+ "description": "Execute a PowerShell command in the current working directory. Returns stdout and stderr. Output is truncated to last 2000 lines or 50KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.",
258
+ "parameters": {
259
+ "type": "object",
260
+ "required": [
261
+ "command"
262
+ ],
263
+ "properties": {
264
+ "command": {
265
+ "type": "string",
266
+ "description": "Shell command to execute"
267
+ },
268
+ "timeout": {
269
+ "type": "number",
270
+ "description": "Timeout in seconds (optional, no default timeout)"
271
+ }
272
+ }
273
+ },
274
+ "promptSnippet": "Execute PowerShell commands",
275
+ "promptGuidelines": [
276
+ "You can inspect PI_* environment variables for current model and session details."
277
+ ],
278
+ "exposure": "direct",
279
+ "constrainedSampling": {
280
+ "type": "json_schema",
281
+ "strict": "prefer"
282
+ }
283
+ },
284
+ {
285
+ "name": "edit",
286
+ "description": "Edit a single file using exact text replacement. Every edits[].oldText must match a unique, non-overlapping region of the original file. If two changes affect the same block or nearby lines, merge them into one edit instead of emitting overlapping edits. Do not include large unchanged regions just to connect distant changes.",
287
+ "parameters": {
288
+ "type": "object",
289
+ "required": [
290
+ "path",
291
+ "edits"
292
+ ],
293
+ "properties": {
294
+ "path": {
295
+ "type": "string",
296
+ "description": "Path to the file to edit (relative or absolute)"
297
+ },
298
+ "edits": {
299
+ "type": "array",
300
+ "items": {
301
+ "type": "object",
302
+ "required": [
303
+ "oldText",
304
+ "newText"
305
+ ],
306
+ "properties": {
307
+ "oldText": {
308
+ "type": "string",
309
+ "description": "Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."
310
+ },
311
+ "newText": {
312
+ "type": "string",
313
+ "description": "Replacement text for this targeted edit."
314
+ }
315
+ }
316
+ },
317
+ "description": "One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."
318
+ }
319
+ }
320
+ },
321
+ "promptSnippet": "Make precise file edits with exact text replacement, including multiple disjoint edits in one call",
322
+ "promptGuidelines": [
323
+ "Use edit for precise changes (edits[].oldText must match exactly)",
324
+ "When changing multiple separate locations in one file, use one edit call with multiple entries in edits[] instead of multiple edit calls",
325
+ "Each edits[].oldText is matched against the original file, not after earlier edits are applied. Do not emit overlapping or nested edits. Merge nearby changes into one edit.",
326
+ "Keep edits[].oldText as small as possible while still being unique in the file. Do not pad with large unchanged regions."
327
+ ],
328
+ "exposure": "direct",
329
+ "constrainedSampling": {
330
+ "type": "json_schema",
331
+ "strict": "prefer"
332
+ }
333
+ },
334
+ {
335
+ "name": "write",
336
+ "description": "Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",
337
+ "parameters": {
338
+ "type": "object",
339
+ "required": [
340
+ "path",
341
+ "content"
342
+ ],
343
+ "properties": {
344
+ "path": {
345
+ "type": "string",
346
+ "description": "Path to the file to write (relative or absolute)"
347
+ },
348
+ "content": {
349
+ "type": "string",
350
+ "description": "Content to write to the file"
351
+ }
352
+ }
353
+ },
354
+ "promptSnippet": "Create or overwrite files",
355
+ "promptGuidelines": [
356
+ "Use write only for new files or complete rewrites."
357
+ ],
358
+ "exposure": "direct",
359
+ "constrainedSampling": {
360
+ "type": "json_schema",
361
+ "strict": "prefer"
362
+ }
363
+ },
364
+ {
365
+ "name": "grep",
366
+ "description": "Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to 100 matches or 50KB (whichever is hit first). Long lines are truncated to 500 chars.",
367
+ "parameters": {
368
+ "type": "object",
369
+ "required": [
370
+ "pattern"
371
+ ],
372
+ "properties": {
373
+ "pattern": {
374
+ "type": "string",
375
+ "description": "Search pattern (regex or literal string)"
376
+ },
377
+ "path": {
378
+ "type": "string",
379
+ "description": "Directory or file to search (default: current directory)"
380
+ },
381
+ "glob": {
382
+ "type": "string",
383
+ "description": "Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'"
384
+ },
385
+ "ignoreCase": {
386
+ "type": "boolean",
387
+ "description": "Case-insensitive search (default: false)"
388
+ },
389
+ "literal": {
390
+ "type": "boolean",
391
+ "description": "Treat pattern as literal string instead of regex (default: false)"
392
+ },
393
+ "context": {
394
+ "type": "number",
395
+ "description": "Number of lines to show before and after each match (default: 0)"
396
+ },
397
+ "limit": {
398
+ "type": "number",
399
+ "description": "Maximum number of matches to return (default: 100)"
400
+ }
401
+ }
402
+ },
403
+ "promptSnippet": "Search file contents for patterns (respects .gitignore)",
404
+ "exposure": "direct"
405
+ },
406
+ {
407
+ "name": "find",
408
+ "description": "Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to 1000 results or 50KB (whichever is hit first).",
409
+ "parameters": {
410
+ "type": "object",
411
+ "required": [
412
+ "pattern"
413
+ ],
414
+ "properties": {
415
+ "pattern": {
416
+ "type": "string",
417
+ "description": "Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'"
418
+ },
419
+ "path": {
420
+ "type": "string",
421
+ "description": "Directory to search in (default: current directory)"
422
+ },
423
+ "limit": {
424
+ "type": "number",
425
+ "description": "Maximum number of results (default: 1000)"
426
+ }
427
+ }
428
+ },
429
+ "promptSnippet": "Find files by glob pattern (respects .gitignore)",
430
+ "exposure": "direct"
431
+ },
432
+ {
433
+ "name": "ls",
434
+ "description": "List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to 500 entries or 50KB (whichever is hit first).",
435
+ "parameters": {
436
+ "type": "object",
437
+ "properties": {
438
+ "path": {
439
+ "type": "string",
440
+ "description": "Directory to list (default: current directory)"
441
+ },
442
+ "limit": {
443
+ "type": "number",
444
+ "description": "Maximum number of entries to return (default: 500)"
445
+ }
446
+ }
447
+ },
448
+ "promptSnippet": "List directory contents",
449
+ "exposure": "direct"
450
+ },
451
+ {
452
+ "name": "echo",
453
+ "description": "Echo a text value.",
454
+ "parameters": {
455
+ "type": "object",
456
+ "required": [
457
+ "text"
458
+ ],
459
+ "properties": {
460
+ "text": {
461
+ "type": "string"
462
+ }
463
+ }
464
+ },
465
+ "exposure": "direct"
466
+ }
467
+ ],
468
+ "activeTools": [
469
+ "read",
470
+ "echo"
471
+ ]
472
+ }
473
+ }