python-codex 0.2.6__py3-none-any.whl → 0.3.0__py3-none-any.whl

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 (84) hide show
  1. pycodex/__init__.py +18 -14
  2. pycodex/agent.py +468 -462
  3. pycodex/bootstrap.py +417 -0
  4. pycodex/cli.py +236 -436
  5. pycodex/compat.py +19 -5
  6. pycodex/context.py +222 -212
  7. pycodex/doctor.py +52 -48
  8. pycodex/events.py +857 -0
  9. pycodex/feishu_card.py +217 -163
  10. pycodex/feishu_link.py +43 -83
  11. pycodex/model.py +329 -252
  12. pycodex/model_metadata.py +19 -7
  13. pycodex/portable.py +90 -52
  14. pycodex/portable_server.py +32 -24
  15. pycodex/prompts/models.json +235 -803
  16. pycodex/protocol.py +177 -137
  17. pycodex/runtime.py +579 -174
  18. pycodex/runtime_services.py +204 -157
  19. pycodex/tools/__init__.py +4 -1
  20. pycodex/tools/apply_patch_tool.py +69 -48
  21. pycodex/tools/base_tool.py +89 -42
  22. pycodex/tools/clock_tool.py +201 -0
  23. pycodex/tools/close_agent_tool.py +2 -2
  24. pycodex/tools/code_mode_manager.py +77 -64
  25. pycodex/tools/exec_command_tool.py +26 -11
  26. pycodex/tools/exec_tool.py +4 -4
  27. pycodex/tools/grep_files_tool.py +12 -10
  28. pycodex/tools/ipython_tool.py +10 -13
  29. pycodex/tools/list_dir_tool.py +13 -9
  30. pycodex/tools/read_file_tool.py +29 -17
  31. pycodex/tools/request_permissions_tool.py +15 -5
  32. pycodex/tools/request_user_input_tool.py +13 -104
  33. pycodex/tools/resume_agent_tool.py +2 -2
  34. pycodex/tools/send_input_tool.py +11 -8
  35. pycodex/tools/shell_command_tool.py +7 -5
  36. pycodex/tools/shell_tool.py +7 -5
  37. pycodex/tools/spawn_agent_tool.py +7 -4
  38. pycodex/tools/unified_exec_manager.py +102 -69
  39. pycodex/tools/update_plan_tool.py +8 -5
  40. pycodex/tools/view_image_tool.py +13 -13
  41. pycodex/tools/wait_agent_tool.py +27 -4
  42. pycodex/tools/wait_tool.py +5 -4
  43. pycodex/tools/web_search_tool.py +4 -2
  44. pycodex/tools/write_stdin_tool.py +12 -11
  45. pycodex/utils/__init__.py +2 -17
  46. pycodex/utils/compactor.py +50 -66
  47. pycodex/utils/debug.py +2 -2
  48. pycodex/utils/dotenv.py +6 -7
  49. pycodex/utils/event_helpers.py +190 -0
  50. pycodex/utils/get_env.py +27 -70
  51. pycodex/utils/image_utils.py +76 -0
  52. pycodex/utils/random_ids.py +1 -2
  53. pycodex/utils/session_persist.py +263 -161
  54. pycodex/utils/truncation.py +21 -45
  55. python_codex-0.3.0.dist-info/METADATA +704 -0
  56. python_codex-0.3.0.dist-info/RECORD +90 -0
  57. responses_server/__init__.py +1 -5
  58. responses_server/__main__.py +0 -1
  59. responses_server/app.py +36 -31
  60. responses_server/config.py +25 -22
  61. responses_server/messages_api.py +96 -49
  62. responses_server/payload_processors.py +25 -19
  63. responses_server/server.py +11 -11
  64. responses_server/session_store.py +14 -11
  65. responses_server/stream_router.py +196 -107
  66. responses_server/tools/custom_adapter.py +17 -16
  67. responses_server/tools/web_search.py +39 -36
  68. responses_server/trajectory_dump.py +51 -13
  69. workspace_server/__main__.py +0 -1
  70. workspace_server/app.py +470 -384
  71. workspace_server/workspace.html +859 -232
  72. workspace_server/workspaces.html +94 -95
  73. workspace_server/workspaces.py +168 -100
  74. pycodex/collaboration.py +0 -20
  75. pycodex/interactive_session.py +0 -415
  76. pycodex/prompts/collaboration_default.md +0 -11
  77. pycodex/prompts/collaboration_plan.md +0 -128
  78. pycodex/utils/toolcall_visualize.py +0 -713
  79. pycodex/utils/visualize.py +0 -553
  80. python_codex-0.2.6.dist-info/METADATA +0 -441
  81. python_codex-0.2.6.dist-info/RECORD +0 -91
  82. {python_codex-0.2.6.dist-info → python_codex-0.3.0.dist-info}/WHEEL +0 -0
  83. {python_codex-0.2.6.dist-info → python_codex-0.3.0.dist-info}/entry_points.txt +0 -0
  84. {python_codex-0.2.6.dist-info → python_codex-0.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -17,7 +17,6 @@
17
17
  --accent-strong: #0859a8;
18
18
  --danger: #b42318;
19
19
  --danger-soft: #fff0ed;
20
- --shadow: 0 14px 36px rgba(24, 39, 75, .08);
21
20
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
22
21
  }
23
22
  @media (prefers-color-scheme: dark) {
@@ -32,7 +31,6 @@
32
31
  --accent-strong: #83bdff;
33
32
  --danger: #ff8c7f;
34
33
  --danger-soft: #321d1b;
35
- --shadow: 0 14px 36px rgba(0, 0, 0, .28);
36
34
  }
37
35
  }
38
36
  * {
@@ -50,13 +48,13 @@
50
48
  }
51
49
  button, a.button {
52
50
  display: inline-flex;
53
- min-height: 34px;
51
+ min-height: 38px;
54
52
  align-items: center;
55
53
  justify-content: center;
56
54
  gap: 7px;
57
55
  border: 1px solid var(--line);
58
- border-radius: 7px;
59
- padding: 7px 11px;
56
+ border-radius: 9px;
57
+ padding: 8px 14px;
60
58
  background: var(--panel);
61
59
  color: var(--text);
62
60
  text-decoration: none;
@@ -72,7 +70,11 @@
72
70
  background: var(--accent-strong);
73
71
  }
74
72
  button.danger {
75
- border-color: color-mix(in srgb, var(--danger) 30%, var(--line) 70%);
73
+ border-color: transparent;
74
+ background: transparent;
75
+ color: var(--muted);
76
+ }
77
+ button.danger:hover {
76
78
  background: var(--danger-soft);
77
79
  color: var(--danger);
78
80
  }
@@ -84,7 +86,7 @@
84
86
  width: 100%;
85
87
  min-height: 38px;
86
88
  border: 1px solid var(--line);
87
- border-radius: 7px;
89
+ border-radius: 9px;
88
90
  padding: 8px 10px;
89
91
  background: var(--panel);
90
92
  color: var(--text);
@@ -95,32 +97,33 @@
95
97
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
96
98
  }
97
99
  input::placeholder {
98
- color: color-mix(in srgb, var(--muted) 45%, transparent);
100
+ color: var(--muted);
99
101
  }
100
102
  .page {
101
- width: min(1180px, calc(100vw - 36px));
103
+ width: min(1180px, calc(100vw - 48px));
102
104
  margin: 0 auto;
103
- padding: 24px 0 42px;
105
+ padding: 28px 0 40px;
104
106
  }
105
107
  .topbar {
106
108
  display: flex;
107
109
  align-items: center;
108
110
  justify-content: space-between;
109
111
  gap: 16px;
110
- margin-bottom: 22px;
112
+ margin-bottom: 24px;
111
113
  }
112
114
  .brand {
113
115
  min-width: 0;
114
116
  }
115
117
  .brand h1 {
116
118
  margin: 0;
117
- font-size: 24px;
118
- line-height: 1.15;
119
- font-weight: 720;
120
- letter-spacing: 0;
119
+ font-size: 28px;
120
+ line-height: 1.25;
121
+ font-weight: 600;
122
+ letter-spacing: -0.8px;
121
123
  }
124
+ .eyebrow { margin-bottom: 6px; color: var(--accent); font-size: 13px; font-weight: 600; }
122
125
  .brand p {
123
- margin: 5px 0 0;
126
+ margin: 10px 0 0;
124
127
  color: var(--muted);
125
128
  line-height: 1.45;
126
129
  }
@@ -136,46 +139,46 @@
136
139
  }
137
140
  .layout {
138
141
  display: grid;
139
- grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
140
- gap: 18px;
142
+ grid-template-columns: minmax(0, 1fr) 300px;
143
+ gap: 28px;
141
144
  align-items: start;
142
145
  }
143
146
  .panel {
144
- border: 1px solid var(--line);
145
- border-radius: 8px;
146
- background: var(--panel);
147
- box-shadow: var(--shadow);
147
+ min-width: 0;
148
148
  }
149
+ .create-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
150
+ .create-panel .panel-head { border-bottom: 0; padding-bottom: 0; }
149
151
  .panel-head {
150
152
  display: flex;
151
153
  align-items: center;
152
154
  justify-content: space-between;
153
155
  gap: 12px;
154
156
  border-bottom: 1px solid var(--line);
155
- padding: 15px 16px;
157
+ padding: 12px 0;
156
158
  }
159
+ .create-panel .panel-head { padding: 20px 20px 0; }
157
160
  .panel-title {
158
161
  margin: 0;
159
- font-size: 15px;
160
- font-weight: 680;
162
+ font-size: 17px;
163
+ font-weight: 600;
161
164
  }
162
165
  .panel-subtitle {
163
- margin: 3px 0 0;
166
+ margin: 8px 0 0;
164
167
  color: var(--muted);
165
- font-size: 12px;
166
- line-height: 1.35;
168
+ font-size: 13px;
169
+ line-height: 1.6;
167
170
  }
168
171
  form {
169
172
  display: grid;
170
- gap: 13px;
171
- padding: 16px;
173
+ gap: 14px;
174
+ padding: 20px;
172
175
  }
173
176
  label {
174
177
  display: grid;
175
- gap: 6px;
176
- color: var(--muted);
177
- font-size: 12px;
178
- font-weight: 620;
178
+ gap: 8px;
179
+ color: var(--text);
180
+ font-size: 13px;
181
+ font-weight: 500;
179
182
  }
180
183
  label span {
181
184
  color: var(--muted);
@@ -187,64 +190,56 @@
187
190
  justify-content: flex-end;
188
191
  margin-top: 2px;
189
192
  }
193
+ .form-actions button { width: 100%; }
190
194
  .summary {
191
- display: grid;
192
- grid-template-columns: repeat(3, minmax(0, 1fr));
193
- gap: 10px;
194
- padding: 16px;
195
+ display: flex;
196
+ gap: 24px;
197
+ padding: 12px 0;
195
198
  border-bottom: 1px solid var(--line);
196
- background: var(--panel-soft);
197
199
  }
198
200
  .metric {
199
201
  min-width: 0;
200
- border: 1px solid var(--line);
201
- border-radius: 8px;
202
- padding: 10px;
203
- background: var(--panel);
202
+ display: flex;
203
+ align-items: baseline;
204
+ gap: 6px;
204
205
  }
205
206
  .metric-value {
206
207
  display: block;
207
- font-size: 20px;
208
- font-weight: 720;
208
+ font-size: 14px;
209
+ font-weight: 600;
209
210
  line-height: 1.1;
210
211
  }
211
212
  .metric-label {
212
213
  display: block;
213
- margin-top: 4px;
214
214
  color: var(--muted);
215
215
  font-size: 12px;
216
216
  }
217
217
  .workspace-list {
218
218
  display: grid;
219
- gap: 10px;
220
- padding: 14px;
221
219
  }
222
220
  .workspace-row {
223
221
  display: grid;
224
- grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto;
225
- gap: 12px;
222
+ grid-template-columns: minmax(0, 1fr) auto;
223
+ gap: 8px 20px;
226
224
  align-items: center;
227
- border: 1px solid var(--line);
228
- border-radius: 8px;
229
- padding: 12px;
230
- background: var(--panel);
225
+ border-bottom: 1px solid var(--line);
226
+ padding: 16px 0;
231
227
  }
232
228
  .workspace-name {
233
229
  min-width: 0;
234
230
  }
231
+ .workspace-name, .paths { grid-column: 1; }
235
232
  .workspace-name strong {
236
233
  display: block;
237
234
  overflow: hidden;
238
235
  text-overflow: ellipsis;
239
236
  white-space: nowrap;
240
- font-size: 15px;
237
+ font-size: 16px;
238
+ font-weight: 600;
241
239
  }
242
240
  .session-count {
243
241
  display: inline-flex;
244
- margin-top: 5px;
245
- border-radius: 999px;
246
- padding: 2px 8px;
247
- background: var(--panel-soft);
242
+ margin-top: 6px;
248
243
  color: var(--muted);
249
244
  font-size: 12px;
250
245
  }
@@ -277,7 +272,11 @@
277
272
  gap: 8px;
278
273
  justify-content: flex-end;
279
274
  flex-wrap: wrap;
275
+ grid-column: 2;
276
+ grid-row: 1 / span 2;
280
277
  }
278
+ .actions a.button { color: var(--accent); border-color: var(--line); }
279
+ .actions a.button:hover { background: var(--panel-soft); }
281
280
  .empty {
282
281
  display: grid;
283
282
  justify-items: center;
@@ -292,8 +291,8 @@
292
291
  }
293
292
  @media (max-width: 860px) {
294
293
  .page {
295
- width: min(100vw - 24px, 720px);
296
- padding-top: 18px;
294
+ width: min(100vw - 40px, 720px);
295
+ padding-top: 28px;
297
296
  }
298
297
  .topbar {
299
298
  align-items: flex-start;
@@ -307,7 +306,6 @@
307
306
  grid-template-columns: 1fr;
308
307
  }
309
308
  .workspace-row {
310
- grid-template-columns: 1fr;
311
309
  align-items: stretch;
312
310
  }
313
311
  .actions {
@@ -315,9 +313,12 @@
315
313
  }
316
314
  }
317
315
  @media (max-width: 520px) {
318
- .summary {
319
- grid-template-columns: 1fr;
320
- }
316
+ .brand h1 { font-size: 28px; }
317
+ .topbar { margin-bottom: 24px; }
318
+ .layout { gap: 32px; }
319
+ .summary { gap: 16px; }
320
+ .workspace-row { grid-template-columns: 1fr; }
321
+ .actions { grid-column: 1; grid-row: auto; }
321
322
  .path-line {
322
323
  grid-template-columns: 1fr;
323
324
  }
@@ -332,42 +333,17 @@
332
333
  <main class="page">
333
334
  <header class="topbar">
334
335
  <div class="brand">
335
- <h1>pycodex workspaces</h1>
336
- <p>Manage local boards and working directories served by this process.</p>
336
+ <div class="eyebrow">pycodex</div>
337
+ <h1>Your workspaces</h1>
338
+ <p>A place for each project. Pick up where you left off.</p>
337
339
  </div>
338
340
  <div id="status" class="status" role="status"></div>
339
341
  </header>
340
342
 
341
343
  <div class="layout">
342
- <section class="panel" aria-labelledby="addTitle">
343
- <div class="panel-head">
344
- <div>
345
- <h2 id="addTitle" class="panel-title">Add Workspace</h2>
346
- <p class="panel-subtitle">Board identifies the workspace. Name is optional.</p>
347
- </div>
348
- </div>
349
- <form id="workspaceForm">
350
- <label>Board
351
- <input id="boardInput" name="board" placeholder="/tmp/pcws-xxxx.html" spellcheck="false">
352
- </label>
353
- <label>Directory
354
- <input id="dirInput" name="dir" placeholder="./" spellcheck="false">
355
- </label>
356
- <label>Name <span>optional</span>
357
- <input id="nameInput" name="name" autocomplete="off" placeholder="workspace-1" spellcheck="false">
358
- </label>
359
- <div class="form-actions">
360
- <button id="addButton" class="primary" type="submit">Add</button>
361
- </div>
362
- </form>
363
- </section>
364
-
365
344
  <section class="panel" aria-labelledby="listTitle">
366
345
  <div class="panel-head">
367
- <div>
368
- <h2 id="listTitle" class="panel-title">Workspace Overview</h2>
369
- <p class="panel-subtitle">Open a board, inspect paths, or remove a workspace from this process.</p>
370
- </div>
346
+ <h2 id="listTitle" class="panel-title">Workspaces</h2>
371
347
  <button id="refreshButton" type="button">Refresh</button>
372
348
  </div>
373
349
  <div class="summary" aria-label="Workspace summary">
@@ -386,6 +362,29 @@
386
362
  </div>
387
363
  <div id="workspaceRows" class="workspace-list"></div>
388
364
  </section>
365
+ <section class="panel create-panel" aria-labelledby="addTitle">
366
+ <div class="panel-head">
367
+ <div>
368
+ <h2 id="addTitle" class="panel-title">New workspace</h2>
369
+ <p class="panel-subtitle">Connect a working directory and a board to get started.</p>
370
+ </div>
371
+ </div>
372
+ <form id="workspaceForm">
373
+ <label>Board
374
+ <input id="boardInput" name="board" placeholder="/tmp/pcws-xxxx.html" spellcheck="false">
375
+ </label>
376
+ <label>Directory
377
+ <input id="dirInput" name="dir" placeholder="./" spellcheck="false">
378
+ </label>
379
+ <label>Name <span>optional</span>
380
+ <input id="nameInput" name="name" autocomplete="off" placeholder="workspace-1" spellcheck="false">
381
+ </label>
382
+ <div class="form-actions">
383
+ <button id="addButton" class="primary" type="submit">Create workspace</button>
384
+ </div>
385
+ </form>
386
+ </section>
387
+
389
388
  </div>
390
389
  </main>
391
390