@papert-code/papert-code 0.3.92 → 0.3.94

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 (50) hide show
  1. package/README.md +99 -3
  2. package/dist/chunks/{chunk-G2NP25TN.js → chunk-2MUETKKX.js} +18 -1
  3. package/dist/chunks/{chunk-P4DPKRC2.js → chunk-423NGIST.js} +18 -1
  4. package/dist/chunks/{chunk-OVTXUA3U.js → chunk-4YLWLT76.js} +135 -119
  5. package/dist/chunks/{chunk-3CUI2HDG.js → chunk-5E2G77WW.js} +18 -1
  6. package/dist/chunks/{chunk-VTNP3O6A.js → chunk-6ZOXSA5F.js} +29070 -37288
  7. package/dist/chunks/{chunk-ICOYQZHB.js → chunk-7T4OCWHU.js} +90 -24
  8. package/dist/chunks/{chunk-EM5S27RC.js → chunk-B4UTHNG5.js} +18 -1
  9. package/dist/chunks/chunk-BMT6LRT3.js +52 -0
  10. package/dist/chunks/{chunk-7FXB5MJS.js → chunk-F77EGXST.js} +18 -1
  11. package/dist/chunks/{chunk-FS5UPVZW.js → chunk-FJQLUUKC.js} +18 -1
  12. package/dist/chunks/{chunk-MO6BWZQC.js → chunk-JATIVKZP.js} +72 -6
  13. package/dist/chunks/{chunk-IV6H2XE4.js → chunk-K5KJBM44.js} +19 -2
  14. package/dist/chunks/{chunk-W6O2LWN4.js → chunk-MEXE5SYY.js} +18 -1
  15. package/dist/chunks/{chunk-THDY5NFO.js → chunk-MHFXK3XK.js} +18 -1
  16. package/dist/chunks/{chunk-4HTLIVVR.js → chunk-NCFEMX7E.js} +17 -0
  17. package/dist/chunks/{chunk-2AKGZQ4A.js → chunk-OIA427PZ.js} +24 -5
  18. package/dist/chunks/{devtools-2MFFCPCG.js → devtools-AE6I2IJN.js} +20 -3
  19. package/dist/chunks/{devtools-ITROVIMB.js → devtools-IPZOX54X.js} +20 -3
  20. package/dist/chunks/dist-3BATS3LO.js +24 -0
  21. package/dist/chunks/{en-TX2CGKV3.js → en-N5RDRPST.js} +18 -1
  22. package/dist/chunks/{gemini-7AQ6BAIN.js → gemini-WYRXV2QC.js} +4038 -2484
  23. package/dist/chunks/{getMachineId-bsd-2RCFHEOM.js → getMachineId-bsd-4WX5XJ3I.js} +20 -3
  24. package/dist/chunks/{getMachineId-darwin-BBFRQYU6.js → getMachineId-darwin-URXQ2X3N.js} +20 -3
  25. package/dist/chunks/{getMachineId-linux-UPET74JV.js → getMachineId-linux-4Y2DTNAA.js} +19 -2
  26. package/dist/chunks/{getMachineId-unsupported-VIGKLEW5.js → getMachineId-unsupported-A5RT6P2V.js} +19 -2
  27. package/dist/chunks/{getMachineId-win-AYPIIM5S.js → getMachineId-win-HIFMWK2N.js} +20 -3
  28. package/dist/chunks/{keychain-token-storage-WM6GUOMH.js → keychain-token-storage-EPJEI2HJ.js} +19 -2
  29. package/dist/chunks/node-fetch-HP6CZCEV.js +28 -0
  30. package/dist/chunks/openaiContentGenerator-EAVO6L3Y.js +51 -0
  31. package/dist/chunks/{papertContentGenerator-FYBOOJV3.js → papertContentGenerator-G4SBF3DR.js} +30 -12
  32. package/dist/chunks/papertOAuth2-4I4JYPZW.js +51 -0
  33. package/dist/chunks/pluginSystem-5MM7PDLU.js +26 -0
  34. package/dist/chunks/server-N2U4FF55.js +26 -0
  35. package/dist/chunks/sharedTokenManager-GSQ3FULT.js +31 -0
  36. package/dist/chunks/undici-FJNCTQAO.js +24 -0
  37. package/dist/chunks/{zh-ACGEBTQR.js → zh-S2V7TL6B.js} +18 -1
  38. package/dist/cli.js +25 -17
  39. package/package.json +6 -2
  40. package/dist/chunks/chunk-BR7CCFAR.js +0 -5151
  41. package/dist/chunks/chunk-RMKGXYYI.js +0 -265
  42. package/dist/chunks/dist-L6NNW4TJ.js +0 -7
  43. package/dist/chunks/multipart-parser-IMIWHGMY.js +0 -381
  44. package/dist/chunks/openaiContentGenerator-WFZAEDJG.js +0 -33
  45. package/dist/chunks/papertOAuth2-JNUOPD7M.js +0 -34
  46. package/dist/chunks/pluginSystem-3V7KBDEE.js +0 -9
  47. package/dist/chunks/server-3DEIAIVB.js +0 -9
  48. package/dist/chunks/sharedTokenManager-Z6PG3UKZ.js +0 -14
  49. package/dist/chunks/src-ERBEIN35.js +0 -1445
  50. package/dist/chunks/undici-EPWKVH6H.js +0 -7
package/README.md CHANGED
@@ -1,18 +1,21 @@
1
1
  # Papert Code
2
2
 
3
- Papert Code is a terminal-native AI coding companion that automates everyday developer workflows. It reads, edits, and generates code across large repositories, automates shell tasks with safety rails, and exposes the same capabilities through a TypeScript SDK and a VS Code companion extension.
3
+ ![Papert Terminal UI](docs/assets/papert-screenshot.png)
4
+
5
+ Papert Code is an AI agent engine for software engineering workflows. It plans, reads, edits, and generates code across large repositories, executes shell and tool actions with safety controls, and exposes the same agent runtime through TypeScript and Python SDKs plus a VS Code companion extension.
4
6
 
5
7
  - Terminal-first agent with `papert`, built for high-signal, multi-turn coding sessions.
6
8
  - Codebase-aware tools: reads and edits files, runs ripgrep queries, executes shell commands, and respects `.gitignore` + `.papertignore`.
7
9
  - Safety and control: structured plans, explicit approval modes (`plan`, `default`, `auto-edit`, `yolo`), and sandbox support (Seatbelt/macOS, Docker, Podman).
8
- - Extensible platform: user commands, subagents, Model Context Protocol (MCP) servers, and a TypeScript SDK for embedding Papert Code into your own apps.
10
+ - Extensible platform: user commands, subagents, Model Context Protocol (MCP) servers, and TypeScript/Python SDKs for embedding Papert Code into your own apps.
9
11
  - Works with any OpenAI-compatible API; pick your own model, base URL, and keys.
10
12
 
11
13
  ## Repository layout
12
14
 
13
15
  - `packages/cli` — the Papert Code CLI (interactive TUI, tools, settings, sandbox integration).
14
16
  - `packages/core` — core tool implementations, MCP plumbing, and shared services.
15
- - `packages/sdk-typescript` — programmatic access to Papert Code (streaming queries + full CLI runner).
17
+ - `packages/sdk-typescript` — programmatic TypeScript SDK (streaming queries, reusable sessions, full CLI runner).
18
+ - `packages/sdk-python` — programmatic Python SDK (streaming queries, reusable sessions, control APIs).
16
19
  - `packages/test-utils` — helpers for integration/terminal tests.
17
20
  - `packages/vscode-ide-companion` — VS Code extension that mirrors the CLI features inside the editor.
18
21
  - `docs/` — user and contributor documentation.
@@ -66,6 +69,27 @@ papert
66
69
  > Generate integration tests for the payment flow.
67
70
  ```
68
71
 
72
+ ## Interface preview
73
+
74
+ ![Papert Web UI](docs/assets/papert-web.png)
75
+
76
+ How to access:
77
+
78
+ - **Terminal UI**: run `papert` in your project directory.
79
+ - **Web UI**: run with remote/web env enabled and open `http://localhost:41242`.
80
+
81
+ Example Web UI environment profile:
82
+
83
+ ```bash
84
+ export PAPERT_REMOTE_ENABLED=1
85
+ export PAPERT_REMOTE_SERVER_TOKEN=hi
86
+ export PAPERT_REMOTE_SESSION_TTL_MS=300000
87
+ export CODER_AGENT_PORT=41242
88
+ export PAPERT_REMOTE_DOCS_ENABLED=1
89
+ export PAPERT_SHARE_PUBLIC_URL_BASE=http://localhost:41242
90
+ papert server --host 0.0.0.0 --port 41242 --docs
91
+ ```
92
+
69
93
  ## Remote driving (daemon/client)
70
94
 
71
95
  Papert Code supports an optional remote-driving mode where you run a daemon on one machine (or container/VM) and connect to it from another machine.
@@ -142,6 +166,9 @@ Install the SDK:
142
166
  npm install @papert-code/sdk-typescript
143
167
  ```
144
168
 
169
+ The SDK package includes `@papert-code/papert-code` as a dependency, so most
170
+ users do not need to install the CLI separately for SDK usage.
171
+
145
172
  ### Streaming queries
146
173
 
147
174
  ```typescript
@@ -182,15 +209,84 @@ const { stdout, exitCode } = await agent.runPrompt(
182
209
  console.log(stdout, exitCode);
183
210
  ```
184
211
 
212
+ ### Reusable sessions (high-level client)
213
+
214
+ ```typescript
215
+ import { createClient } from '@papert-code/sdk-typescript';
216
+
217
+ const client = createClient({
218
+ cwd: '/path/to/project',
219
+ permissionMode: 'auto-edit',
220
+ });
221
+
222
+ const session = client.createSession({ sessionId: 'demo-session' });
223
+ await session.send('Create TODO.md with 3 items');
224
+ await session.send('Now summarize TODO.md');
225
+ await client.close();
226
+ ```
227
+
185
228
  SDK features:
186
229
 
187
230
  - Multi-turn streaming API with tool awareness.
231
+ - High-level session API (`createClient`, `session.send`, `session.stream`).
188
232
  - Permission hooks (`canUseTool`), custom tool allow/deny lists, and MCP server wiring.
189
233
  - Abort support via `AbortController`, per-call environment overrides, and subagent configuration.
190
234
  - Works with the installed `papert` binary or a specified CLI path.
191
235
 
192
236
  Examples live under `packages/sdk-typescript/examples` (ESM, no ts-node required).
193
237
 
238
+ TypeScript SDK docs:
239
+
240
+ - `docs/cli/sdk-typescript.md`
241
+ - `docs/cli/sdk-typescript-multi-agent-skills.md`
242
+
243
+ ## Python SDK
244
+
245
+ Install the SDK:
246
+
247
+ ```bash
248
+ pip install papert-code-sdk
249
+ ```
250
+
251
+ ### Streaming query
252
+
253
+ ```python
254
+ import asyncio
255
+ from papert_code_sdk import query
256
+
257
+ async def main():
258
+ result = query(
259
+ prompt="List top-level folders in this repo",
260
+ options={"cwd": "/path/to/project"},
261
+ )
262
+ async for message in result:
263
+ if message.type == "assistant":
264
+ print(message.message.content)
265
+
266
+ asyncio.run(main())
267
+ ```
268
+
269
+ ### Reusable sessions (high-level client)
270
+
271
+ ```python
272
+ import asyncio
273
+ from papert_code_sdk import create_client
274
+
275
+ async def main():
276
+ client = create_client({"cwd": "/path/to/project", "permissionMode": "auto-edit"})
277
+ session = client.create_session(session_id="demo-session")
278
+ await session.send("Create TODO.md with 3 items")
279
+ await session.send("Now summarize TODO.md")
280
+ await client.close()
281
+
282
+ asyncio.run(main())
283
+ ```
284
+
285
+ Python SDK docs:
286
+
287
+ - `docs/cli/sdk-python.md`
288
+ - `docs/cli/sdk-python-multi-agent-skills.md`
289
+
194
290
  ## VS Code companion
195
291
 
196
292
  `packages/vscode-ide-companion` mirrors the CLI experience inside VS Code: native diffing, context awareness, and the same approval modes. Build it with `npm run build:vscode` or install from the marketplace once published.
@@ -1,11 +1,28 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ const __papertOriginalEmitWarning = process.emitWarning.bind(process);
4
+ process.emitWarning = function patchedEmitWarning(warning, ...args) {
5
+ if (!process.env.PAPERT_SHOW_NODE_DEPRECATIONS) {
6
+ const warningCode =
7
+ (warning && typeof warning === 'object' && 'code' in warning && warning.code) ||
8
+ (args.length > 1 && typeof args[1] === 'string' && args[1]) ||
9
+ (args.length > 0 &&
10
+ args[0] &&
11
+ typeof args[0] === 'object' &&
12
+ 'code' in args[0] &&
13
+ args[0].code);
14
+ if (warningCode === 'DEP0040' || warningCode === 'DEP0169') {
15
+ return;
16
+ }
17
+ }
18
+ return __papertOriginalEmitWarning(warning, ...args);
19
+ };
3
20
  import {
4
21
  __esm,
5
22
  __export,
6
23
  __name,
7
24
  init_esbuild_shims
8
- } from "./chunk-4HTLIVVR.js";
25
+ } from "./chunk-NCFEMX7E.js";
9
26
 
10
27
  // node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
11
28
  var _globalThis;
@@ -1,11 +1,28 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ const __papertOriginalEmitWarning = process.emitWarning.bind(process);
4
+ process.emitWarning = function patchedEmitWarning(warning, ...args) {
5
+ if (!process.env.PAPERT_SHOW_NODE_DEPRECATIONS) {
6
+ const warningCode =
7
+ (warning && typeof warning === 'object' && 'code' in warning && warning.code) ||
8
+ (args.length > 1 && typeof args[1] === 'string' && args[1]) ||
9
+ (args.length > 0 &&
10
+ args[0] &&
11
+ typeof args[0] === 'object' &&
12
+ 'code' in args[0] &&
13
+ args[0].code);
14
+ if (warningCode === 'DEP0040' || warningCode === 'DEP0169') {
15
+ return;
16
+ }
17
+ }
18
+ return __papertOriginalEmitWarning(warning, ...args);
19
+ };
3
20
  import {
4
21
  __commonJS,
5
22
  __name,
6
23
  __require,
7
24
  init_esbuild_shims
8
- } from "./chunk-4HTLIVVR.js";
25
+ } from "./chunk-NCFEMX7E.js";
9
26
 
10
27
  // node_modules/undici/lib/core/symbols.js
11
28
  var require_symbols = __commonJS({
@@ -1,126 +1,26 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ const __papertOriginalEmitWarning = process.emitWarning.bind(process);
4
+ process.emitWarning = function patchedEmitWarning(warning, ...args) {
5
+ if (!process.env.PAPERT_SHOW_NODE_DEPRECATIONS) {
6
+ const warningCode =
7
+ (warning && typeof warning === 'object' && 'code' in warning && warning.code) ||
8
+ (args.length > 1 && typeof args[1] === 'string' && args[1]) ||
9
+ (args.length > 0 &&
10
+ args[0] &&
11
+ typeof args[0] === 'object' &&
12
+ 'code' in args[0] &&
13
+ args[0].code);
14
+ if (warningCode === 'DEP0040' || warningCode === 'DEP0169') {
15
+ return;
16
+ }
17
+ }
18
+ return __papertOriginalEmitWarning(warning, ...args);
19
+ };
3
20
  import {
4
21
  __name,
5
22
  init_esbuild_shims
6
- } from "./chunk-4HTLIVVR.js";
7
-
8
- // packages/core/dist/src/utils/errors.js
9
- init_esbuild_shims();
10
- function isNodeError(error) {
11
- return error instanceof Error && "code" in error;
12
- }
13
- __name(isNodeError, "isNodeError");
14
- function getErrorMessage(error) {
15
- if (error instanceof Error) {
16
- return error.message;
17
- }
18
- try {
19
- return String(error);
20
- } catch {
21
- return "Failed to get error details";
22
- }
23
- }
24
- __name(getErrorMessage, "getErrorMessage");
25
- var FatalError = class extends Error {
26
- static {
27
- __name(this, "FatalError");
28
- }
29
- exitCode;
30
- constructor(message, exitCode) {
31
- super(message);
32
- this.exitCode = exitCode;
33
- }
34
- };
35
- var FatalAuthenticationError = class extends FatalError {
36
- static {
37
- __name(this, "FatalAuthenticationError");
38
- }
39
- constructor(message) {
40
- super(message, 41);
41
- }
42
- };
43
- var FatalInputError = class extends FatalError {
44
- static {
45
- __name(this, "FatalInputError");
46
- }
47
- constructor(message) {
48
- super(message, 42);
49
- }
50
- };
51
- var FatalSandboxError = class extends FatalError {
52
- static {
53
- __name(this, "FatalSandboxError");
54
- }
55
- constructor(message) {
56
- super(message, 44);
57
- }
58
- };
59
- var FatalConfigError = class extends FatalError {
60
- static {
61
- __name(this, "FatalConfigError");
62
- }
63
- constructor(message) {
64
- super(message, 52);
65
- }
66
- };
67
- var FatalTurnLimitedError = class extends FatalError {
68
- static {
69
- __name(this, "FatalTurnLimitedError");
70
- }
71
- constructor(message) {
72
- super(message, 53);
73
- }
74
- };
75
- var FatalCancellationError = class extends FatalError {
76
- static {
77
- __name(this, "FatalCancellationError");
78
- }
79
- constructor(message) {
80
- super(message, 130);
81
- }
82
- };
83
- var ForbiddenError = class extends Error {
84
- static {
85
- __name(this, "ForbiddenError");
86
- }
87
- };
88
- var UnauthorizedError = class extends Error {
89
- static {
90
- __name(this, "UnauthorizedError");
91
- }
92
- };
93
- var BadRequestError = class extends Error {
94
- static {
95
- __name(this, "BadRequestError");
96
- }
97
- };
98
- function toFriendlyError(error) {
99
- if (error && typeof error === "object" && "response" in error) {
100
- const gaxiosError = error;
101
- const data = parseResponseData(gaxiosError);
102
- if (data.error && data.error.message && data.error.code) {
103
- switch (data.error.code) {
104
- case 400:
105
- return new BadRequestError(data.error.message);
106
- case 401:
107
- return new UnauthorizedError(data.error.message);
108
- case 403:
109
- return new ForbiddenError(data.error.message);
110
- default:
111
- }
112
- }
113
- }
114
- return error;
115
- }
116
- __name(toFriendlyError, "toFriendlyError");
117
- function parseResponseData(error) {
118
- if (typeof error.response?.data === "string") {
119
- return JSON.parse(error.response?.data);
120
- }
121
- return error.response?.data;
122
- }
123
- __name(parseResponseData, "parseResponseData");
23
+ } from "./chunk-NCFEMX7E.js";
124
24
 
125
25
  // node_modules/open/index.js
126
26
  init_esbuild_shims();
@@ -619,10 +519,126 @@ defineLazyProperty(apps, "browser", () => "browser");
619
519
  defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
620
520
  var open_default = open;
621
521
 
522
+ // packages/core/dist/src/utils/errors.js
523
+ init_esbuild_shims();
524
+ function isNodeError(error) {
525
+ return error instanceof Error && "code" in error;
526
+ }
527
+ __name(isNodeError, "isNodeError");
528
+ function getErrorMessage(error) {
529
+ if (error instanceof Error) {
530
+ return error.message;
531
+ }
532
+ try {
533
+ return String(error);
534
+ } catch {
535
+ return "Failed to get error details";
536
+ }
537
+ }
538
+ __name(getErrorMessage, "getErrorMessage");
539
+ var FatalError = class extends Error {
540
+ static {
541
+ __name(this, "FatalError");
542
+ }
543
+ exitCode;
544
+ constructor(message, exitCode) {
545
+ super(message);
546
+ this.exitCode = exitCode;
547
+ }
548
+ };
549
+ var FatalAuthenticationError = class extends FatalError {
550
+ static {
551
+ __name(this, "FatalAuthenticationError");
552
+ }
553
+ constructor(message) {
554
+ super(message, 41);
555
+ }
556
+ };
557
+ var FatalInputError = class extends FatalError {
558
+ static {
559
+ __name(this, "FatalInputError");
560
+ }
561
+ constructor(message) {
562
+ super(message, 42);
563
+ }
564
+ };
565
+ var FatalSandboxError = class extends FatalError {
566
+ static {
567
+ __name(this, "FatalSandboxError");
568
+ }
569
+ constructor(message) {
570
+ super(message, 44);
571
+ }
572
+ };
573
+ var FatalConfigError = class extends FatalError {
574
+ static {
575
+ __name(this, "FatalConfigError");
576
+ }
577
+ constructor(message) {
578
+ super(message, 52);
579
+ }
580
+ };
581
+ var FatalTurnLimitedError = class extends FatalError {
582
+ static {
583
+ __name(this, "FatalTurnLimitedError");
584
+ }
585
+ constructor(message) {
586
+ super(message, 53);
587
+ }
588
+ };
589
+ var FatalCancellationError = class extends FatalError {
590
+ static {
591
+ __name(this, "FatalCancellationError");
592
+ }
593
+ constructor(message) {
594
+ super(message, 130);
595
+ }
596
+ };
597
+ var ForbiddenError = class extends Error {
598
+ static {
599
+ __name(this, "ForbiddenError");
600
+ }
601
+ };
602
+ var UnauthorizedError = class extends Error {
603
+ static {
604
+ __name(this, "UnauthorizedError");
605
+ }
606
+ };
607
+ var BadRequestError = class extends Error {
608
+ static {
609
+ __name(this, "BadRequestError");
610
+ }
611
+ };
612
+ function toFriendlyError(error) {
613
+ if (error && typeof error === "object" && "response" in error) {
614
+ const gaxiosError = error;
615
+ const data = parseResponseData(gaxiosError);
616
+ if (data.error && data.error.message && data.error.code) {
617
+ switch (data.error.code) {
618
+ case 400:
619
+ return new BadRequestError(data.error.message);
620
+ case 401:
621
+ return new UnauthorizedError(data.error.message);
622
+ case 403:
623
+ return new ForbiddenError(data.error.message);
624
+ default:
625
+ }
626
+ }
627
+ }
628
+ return error;
629
+ }
630
+ __name(toFriendlyError, "toFriendlyError");
631
+ function parseResponseData(error) {
632
+ if (typeof error.response?.data === "string") {
633
+ return JSON.parse(error.response?.data);
634
+ }
635
+ return error.response?.data;
636
+ }
637
+ __name(parseResponseData, "parseResponseData");
638
+
622
639
  export {
623
640
  isNodeError,
624
641
  getErrorMessage,
625
- FatalError,
626
642
  FatalAuthenticationError,
627
643
  FatalInputError,
628
644
  FatalSandboxError,
@@ -1,10 +1,27 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ const __papertOriginalEmitWarning = process.emitWarning.bind(process);
4
+ process.emitWarning = function patchedEmitWarning(warning, ...args) {
5
+ if (!process.env.PAPERT_SHOW_NODE_DEPRECATIONS) {
6
+ const warningCode =
7
+ (warning && typeof warning === 'object' && 'code' in warning && warning.code) ||
8
+ (args.length > 1 && typeof args[1] === 'string' && args[1]) ||
9
+ (args.length > 0 &&
10
+ args[0] &&
11
+ typeof args[0] === 'object' &&
12
+ 'code' in args[0] &&
13
+ args[0].code);
14
+ if (warningCode === 'DEP0040' || warningCode === 'DEP0169') {
15
+ return;
16
+ }
17
+ }
18
+ return __papertOriginalEmitWarning(warning, ...args);
19
+ };
3
20
  import {
4
21
  __commonJS,
5
22
  __name,
6
23
  init_esbuild_shims
7
- } from "./chunk-4HTLIVVR.js";
24
+ } from "./chunk-NCFEMX7E.js";
8
25
 
9
26
  // node_modules/react-devtools-core/dist/backend.js
10
27
  var require_backend = __commonJS({