@piagent/platform 1.13.1 → 1.15.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/CHANGELOG.md +27 -0
- package/README.md +2 -2
- package/README.vi.md +2 -2
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/en/windows.md +20 -1
- package/docs/languages.json +4 -4
- package/docs/model-options.md +16 -0
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +2 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs/vi/windows.md +20 -1
- package/docs-site/architecture.html +2 -1
- package/docs-site/benchmark.html +2 -1
- package/docs-site/commands.html +2 -1
- package/docs-site/content/en/index.html +4 -4
- package/docs-site/content/en/quickstart.html +1 -1
- package/docs-site/content/en/whats-new.html +23 -0
- package/docs-site/content/en/windows.html +76 -0
- package/docs-site/content/index.html +4 -4
- package/docs-site/content/quickstart.html +2 -2
- package/docs-site/content/whats-new.html +23 -0
- package/docs-site/content/windows.html +76 -0
- package/docs-site/context-engine.html +2 -1
- package/docs-site/ecosystem.html +2 -1
- package/docs-site/en/architecture.html +2 -1
- package/docs-site/en/benchmark.html +2 -1
- package/docs-site/en/commands.html +2 -1
- package/docs-site/en/context-engine.html +2 -1
- package/docs-site/en/ecosystem.html +2 -1
- package/docs-site/en/index.html +6 -5
- package/docs-site/en/mcp-approval.html +2 -1
- package/docs-site/en/mcp-auth.html +2 -1
- package/docs-site/en/mcp-servers.html +2 -1
- package/docs-site/en/mcp.html +2 -1
- package/docs-site/en/permissions.html +2 -1
- package/docs-site/en/profiles.html +2 -1
- package/docs-site/en/quickstart.html +5 -4
- package/docs-site/en/runtime.html +2 -1
- package/docs-site/en/scope.html +2 -1
- package/docs-site/en/security.html +2 -1
- package/docs-site/en/team.html +2 -1
- package/docs-site/en/whats-new.html +27 -3
- package/docs-site/en/windows.html +216 -0
- package/docs-site/en/workflows.html +2 -1
- package/docs-site/index.html +6 -5
- package/docs-site/mcp-approval.html +2 -1
- package/docs-site/mcp-auth.html +2 -1
- package/docs-site/mcp-servers.html +2 -1
- package/docs-site/mcp.html +2 -1
- package/docs-site/permissions.html +2 -1
- package/docs-site/profiles.html +2 -1
- package/docs-site/quickstart.html +6 -5
- package/docs-site/runtime.html +2 -1
- package/docs-site/scope.html +2 -1
- package/docs-site/security.html +2 -1
- package/docs-site/team.html +2 -1
- package/docs-site/whats-new.html +27 -3
- package/docs-site/windows.html +216 -0
- package/docs-site/workflows.html +2 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
- package/package.json +1 -1
- package/packages/piagent-core/managed/broker-client.mjs +7 -1
- package/packages/piagent-core/managed/helper-run.mjs +2 -2
- package/packages/piagent-core/managed/sandbox-diagnostic.mjs +3 -0
- package/packages/piagent-core/managed/session.mjs +2 -2
- package/packages/piagent-core/managed/tool-boundary.mjs +5 -1
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/runtime/managed-failure.mjs +9 -1
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-CyT2G1H2.js → MarkdownMessage-PIk4Femi.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{index-BBEa7Ger.js → index-DeCt-FaN.js} +12 -12
- package/packages/piagent-webui/dist/client/index.html +1 -1
- package/packages/piagent-webui/gateway/pi-host.ts +16 -2
- package/scripts/build-docs-site.mjs +11 -0
- package/scripts/configure-model-scope.sh +37 -8
- package/scripts/install-global.sh +22 -4
- package/scripts/update-global.mjs +7 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="vi" data-copy-success="Đã lấy" data-copy-fallback="Chọn lệnh">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Piagent trên Windows bằng một lệnh · Pi Agent Platform Docs</title>
|
|
7
|
+
<meta name="description" content="Một lệnh PowerShell cài WSL2, Ubuntu, Piagent và Agent Watch, nối key công ty và thêm Piagent vào Start menu; chạy lại để cập nhật." />
|
|
8
|
+
<meta name="theme-color" content="#050505" />
|
|
9
|
+
<link rel="canonical" href="https://piagent.io.vn/windows" />
|
|
10
|
+
<link rel="alternate" hreflang="vi" href="https://piagent.io.vn/windows" />
|
|
11
|
+
<link rel="alternate" hreflang="en" href="https://piagent.io.vn/en/windows" />
|
|
12
|
+
<link rel="alternate" hreflang="x-default" href="https://piagent.io.vn/windows" />
|
|
13
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
14
|
+
<meta property="og:title" content="Piagent trên Windows bằng một lệnh · Pi Agent Platform Docs" />
|
|
15
|
+
<meta property="og:description" content="Một lệnh PowerShell cài WSL2, Ubuntu, Piagent và Agent Watch, nối key công ty và thêm Piagent vào Start menu; chạy lại để cập nhật." />
|
|
16
|
+
<meta property="og:url" content="https://piagent.io.vn/windows" />
|
|
17
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
18
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
19
|
+
<link
|
|
20
|
+
href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap"
|
|
21
|
+
rel="stylesheet"
|
|
22
|
+
/>
|
|
23
|
+
<link rel="stylesheet" href="/assets/docs.css" />
|
|
24
|
+
<script src="/assets/docs.js" defer></script>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<header class="topbar">
|
|
28
|
+
<a class="brand" href="/" aria-label="Pi Agent Platform">
|
|
29
|
+
<span class="brand-mark"><img src="/assets/piagent-logo.svg" alt="" /></span>
|
|
30
|
+
<span>Pi Agent Platform</span>
|
|
31
|
+
</a>
|
|
32
|
+
<div class="top-actions">
|
|
33
|
+
<span class="pill"><span class="pill-dot"></span>v1.15.0 docs · VI</span>
|
|
34
|
+
<nav class="language-switch" aria-label="Ngôn ngữ">
|
|
35
|
+
<a class="language-option current" href="/windows" hreflang="vi" lang="vi" aria-current="true">VI</a>
|
|
36
|
+
<a class="language-option" href="/en/windows" hreflang="en" lang="en">EN</a>
|
|
37
|
+
</nav>
|
|
38
|
+
<a class="button social" href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer" aria-label="Mở GitHub repository">
|
|
39
|
+
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
40
|
+
<path d="M7 17 17 7M9 7h8v8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
41
|
+
</svg>
|
|
42
|
+
GitHub
|
|
43
|
+
</a>
|
|
44
|
+
<button class="button mobile-menu" type="button" data-menu>Lộ trình</button>
|
|
45
|
+
<a class="button top-command-link" href="/commands">Commands</a>
|
|
46
|
+
</div>
|
|
47
|
+
</header>
|
|
48
|
+
|
|
49
|
+
<div class="layout with-toc">
|
|
50
|
+
<aside class="sidebar" data-sidebar>
|
|
51
|
+
<div class="sidebar-search" aria-label="Tìm trong tài liệu">
|
|
52
|
+
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
53
|
+
<path d="M10.8 18.1a7.3 7.3 0 1 1 0-14.6 7.3 7.3 0 0 1 0 14.6Zm5.3-1.7 4.4 4.4" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
|
|
54
|
+
</svg>
|
|
55
|
+
<input type="search" placeholder="Tìm trang" data-filter />
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<nav aria-label="Tài liệu">
|
|
59
|
+
<div class="nav-group">
|
|
60
|
+
<p class="nav-title">Get started</p>
|
|
61
|
+
<a class="nav-link" href="/">Overview</a>
|
|
62
|
+
<a class="nav-link" href="/ecosystem">Hệ sinh thái</a>
|
|
63
|
+
<a class="nav-link" href="/quickstart">Quickstart</a>
|
|
64
|
+
<a class="nav-link current" href="/windows" aria-current="page">Cài trên Windows</a>
|
|
65
|
+
<a class="nav-link" href="/whats-new">Có gì mới</a>
|
|
66
|
+
<a class="nav-link" href="/scope">Phạm vi platform</a>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="nav-group">
|
|
69
|
+
<p class="nav-title">Build</p>
|
|
70
|
+
<a class="nav-link" href="/profiles">Project profile</a>
|
|
71
|
+
<a class="nav-link" href="/permissions">Permission modes</a>
|
|
72
|
+
<a class="nav-link" href="/commands">Command catalog</a>
|
|
73
|
+
<a class="nav-link" href="/workflows">Workflows</a>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="nav-group">
|
|
76
|
+
<p class="nav-title">MCP</p>
|
|
77
|
+
<a class="nav-link" href="/mcp">MCP overview</a>
|
|
78
|
+
<a class="nav-link" href="/mcp-servers">Quản lý server</a>
|
|
79
|
+
<a class="nav-link" href="/mcp-auth">Auth và readiness</a>
|
|
80
|
+
<a class="nav-link" href="/mcp-approval">Approval gate</a>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="nav-group">
|
|
83
|
+
<p class="nav-title">Operate</p>
|
|
84
|
+
<a class="nav-link" href="/security">Security model</a>
|
|
85
|
+
<a class="nav-link" href="/architecture">Architecture</a>
|
|
86
|
+
<a class="nav-link" href="/context-engine">Context Engine</a>
|
|
87
|
+
<a class="nav-link" href="/benchmark">Benchmark</a>
|
|
88
|
+
<a class="nav-link" href="/runtime">Runtime tools</a>
|
|
89
|
+
<a class="nav-link" href="/team">Team usage</a>
|
|
90
|
+
</div>
|
|
91
|
+
</nav>
|
|
92
|
+
</aside>
|
|
93
|
+
|
|
94
|
+
<main>
|
|
95
|
+
<div class="content-shell" data-article>
|
|
96
|
+
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
97
|
+
<a href="/">Docs</a>
|
|
98
|
+
<span aria-hidden="true">/</span>
|
|
99
|
+
<span>Get started</span>
|
|
100
|
+
<span aria-hidden="true">/</span>
|
|
101
|
+
<span>Cài trên Windows</span>
|
|
102
|
+
</nav>
|
|
103
|
+
<div class="page-head">
|
|
104
|
+
<h1>Piagent trên Windows bằng một lệnh</h1>
|
|
105
|
+
<p>Một lệnh PowerShell cài WSL2, Ubuntu, Piagent và Agent Watch, nối key công ty và thêm Piagent vào Start menu; chạy lại để cập nhật.</p>
|
|
106
|
+
</div>
|
|
107
|
+
<section class="section">
|
|
108
|
+
|
|
109
|
+
<div class="steps">
|
|
110
|
+
<article class="step">
|
|
111
|
+
<div>
|
|
112
|
+
<h3 id="cai-mot-lenh">Cài bằng một lệnh</h3>
|
|
113
|
+
<p>Mở <strong>PowerShell</strong> (Start → gõ PowerShell) và chạy:</p>
|
|
114
|
+
<div class="command-card">
|
|
115
|
+
<header><span>Một lệnh</span><button class="clip-btn" data-clip="irm https://raw.githubusercontent.com/Vt-mmm/agentwatch/main/windows/setup.ps1 | iex">Lấy lệnh</button></header>
|
|
116
|
+
<pre><code>irm https://raw.githubusercontent.com/Vt-mmm/agentwatch/main/windows/setup.ps1 | iex</code></pre>
|
|
117
|
+
</div>
|
|
118
|
+
<p>Lệnh này lần lượt:</p>
|
|
119
|
+
<ol>
|
|
120
|
+
<li>Cài <strong>WSL2</strong> nếu máy chưa có. Windows hỏi quyền quản trị; lần đầu cần khởi động lại, và cài đặt tự chạy tiếp khi bạn đăng nhập lại.</li>
|
|
121
|
+
<li>Cài <strong>Ubuntu</strong>, tạo user Ubuntu theo tên Windows của bạn và hỏi mật khẩu cho user đó (dùng khi chạy <span class="inline-code">sudo</span>).</li>
|
|
122
|
+
<li>Cài <strong>Piagent trong Ubuntu</strong>: gói hệ thống, sandbox bubblewrap, Node 24, Piagent và đúng bản Pi mà release đang pin.</li>
|
|
123
|
+
<li>Hỏi <strong>mã kết nối</strong> admin gửi. Dán vào thì lệnh cài Agent Watch, kết nối key công ty và nối Piagent trong Ubuntu với key đó. Bấm Enter để bỏ qua nếu bạn chỉ dùng tài khoản AI của riêng mình.</li>
|
|
124
|
+
<li>Thêm mục <strong>Piagent</strong> vào Start menu và mở dashboard trong trình duyệt.</li>
|
|
125
|
+
</ol>
|
|
126
|
+
<p><strong>Cập nhật:</strong> chạy lại đúng lệnh trên. Những bước đã xong được bỏ qua; Piagent và Agent Watch được cập nhật và nối lại key công ty.</p>
|
|
127
|
+
<p>Agent Watch là bản nội bộ chưa ký số: nếu Windows SmartScreen cảnh báo, chọn <em>More info → Run anyway</em>.</p>
|
|
128
|
+
</div>
|
|
129
|
+
</article>
|
|
130
|
+
|
|
131
|
+
<article class="step">
|
|
132
|
+
<div>
|
|
133
|
+
<h3 id="dung-hang-ngay">Dùng hằng ngày</h3>
|
|
134
|
+
<p>Mở <strong>Piagent</strong> từ Start menu: một cửa sổ Ubuntu mở dashboard trong trình duyệt Windows. Giữ cửa sổ đó mở khi đang dùng.</p>
|
|
135
|
+
<p>Để project trong ổ của Ubuntu (ví dụ <span class="inline-code">~/projects</span>) cho nhanh; folder Windows (<span class="inline-code">/mnt/c/...</span>) vẫn dùng được nhưng chậm hơn rõ với npm và git. VS Code trên Windows mở thẳng folder trong Ubuntu qua extension WSL.</p>
|
|
136
|
+
</div>
|
|
137
|
+
</article>
|
|
138
|
+
|
|
139
|
+
<article class="step">
|
|
140
|
+
<div>
|
|
141
|
+
<h3 id="khi-cai-bi-loi">Khi cài bị lỗi</h3>
|
|
142
|
+
<div class="table-wrap compact-table">
|
|
143
|
+
<table>
|
|
144
|
+
<thead>
|
|
145
|
+
<tr>
|
|
146
|
+
<th>Dấu hiệu</th>
|
|
147
|
+
<th>Cách xử lý</th>
|
|
148
|
+
</tr>
|
|
149
|
+
</thead>
|
|
150
|
+
<tbody>
|
|
151
|
+
<tr>
|
|
152
|
+
<td>Lệnh đòi khởi động lại mãi, hoặc Ubuntu báo <span class="inline-code">0x80370114</span></td>
|
|
153
|
+
<td>Windows ghi đã bật <em>Virtual Machine Platform</em> nhưng thiếu dịch vụ máy ảo. Nếu <span class="inline-code">Test-Path C:\Windows\System32\vmcompute.exe</span> ra <span class="inline-code">False</span>: trong PowerShell <em>Run as administrator</em> chạy <span class="inline-code">DISM /Online /Cleanup-Image /RestoreHealth</span> và <span class="inline-code">sfc /scannow</span>, rồi tắt và bật lại <em>VirtualMachinePlatform</em> bằng <span class="inline-code">dism.exe</span> (mỗi lần Restart). Vẫn thiếu: cài đè Windows 11 bằng Installation Assistant, chọn giữ file và ứng dụng.</td>
|
|
154
|
+
</tr>
|
|
155
|
+
<tr>
|
|
156
|
+
<td><span class="inline-code">0x80370102</span> hoặc lỗi ảo hoá</td>
|
|
157
|
+
<td>Bật Virtualization (Intel VT-x / AMD SVM) trong BIOS.</td>
|
|
158
|
+
</tr>
|
|
159
|
+
<tr>
|
|
160
|
+
<td>Tải Ubuntu lỗi mạng</td>
|
|
161
|
+
<td><span class="inline-code">wsl --install -d Ubuntu --web-download</span>, rồi chạy lại lệnh cài.</td>
|
|
162
|
+
</tr>
|
|
163
|
+
<tr>
|
|
164
|
+
<td>Dashboard báo Agent Watch hoặc Piagent vừa cập nhật</td>
|
|
165
|
+
<td>Chạy lại lệnh cài, hoặc trong Agent Watch bấm <strong>Kết nối Piagent trong WSL</strong>.</td>
|
|
166
|
+
</tr>
|
|
167
|
+
</tbody>
|
|
168
|
+
</table>
|
|
169
|
+
</div>
|
|
170
|
+
<p>Kiểm tra máy: trong Ubuntu chạy <span class="inline-code">piagent studio --doctor</span>. Khi máy đã khởi động lại mà Windows vẫn thiếu dịch vụ máy ảo, lệnh cài in đúng các bước sửa ở trên thay vì đòi khởi động lại tiếp.</p>
|
|
171
|
+
</div>
|
|
172
|
+
</article>
|
|
173
|
+
|
|
174
|
+
<article class="step">
|
|
175
|
+
<div>
|
|
176
|
+
<h3 id="vi-sao-wsl2">Vì sao là WSL2</h3>
|
|
177
|
+
<p>Ubuntu trong WSL2 chạy ngay bên trong Windows như một máy ảo nhẹ do Windows quản lý, không phải cài song song. Chế độ công ty cần sandbox của hệ điều hành cho mọi lệnh agent chạy: Seatbelt trên macOS, bubblewrap trên Linux và WSL2. Windows chưa có sandbox tương đương, nên Piagent chạy trong WSL2.</p>
|
|
178
|
+
<p>Chạy thẳng trên Windows (không qua WSL) mới là bản xem trước cho chế độ cá nhân. Cài từng bước bằng tay và chi tiết sandbox: <a href="https://github.com/Vt-mmm/piagent/blob/main/docs/vi/windows.md">Piagent trên Windows</a>.</p>
|
|
179
|
+
</div>
|
|
180
|
+
</article>
|
|
181
|
+
</div>
|
|
182
|
+
</section>
|
|
183
|
+
<nav class="pager" aria-label="Trang kế tiếp">
|
|
184
|
+
<a class="pager-prev" href="/quickstart">
|
|
185
|
+
<span class="pager-label">Trước</span>
|
|
186
|
+
<span class="pager-title">Quickstart</span>
|
|
187
|
+
</a>
|
|
188
|
+
<a class="pager-next" href="/whats-new">
|
|
189
|
+
<span class="pager-label">Tiếp</span>
|
|
190
|
+
<span class="pager-title">Có gì mới</span>
|
|
191
|
+
</a>
|
|
192
|
+
</nav>
|
|
193
|
+
|
|
194
|
+
<footer class="footer">
|
|
195
|
+
<p>Pi Agent Platform docs · static HTML · governed agent workflow</p>
|
|
196
|
+
<div class="footer-links" aria-label="Liên kết ngoài">
|
|
197
|
+
<a href="https://piagent.io.vn" target="_blank" rel="noopener noreferrer">piagent.io.vn</a>
|
|
198
|
+
<a href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer">GitHub repository</a>
|
|
199
|
+
<a href="/en/windows" hreflang="en">English</a>
|
|
200
|
+
<a href="https://www.facebook.com/vinhtam0544/" target="_blank" rel="noopener noreferrer">Facebook profile</a>
|
|
201
|
+
</div>
|
|
202
|
+
</footer>
|
|
203
|
+
</div>
|
|
204
|
+
</main>
|
|
205
|
+
|
|
206
|
+
<aside class="toc" aria-label="Mục lục trang">
|
|
207
|
+
<p class="toc-title">Trên trang này</p>
|
|
208
|
+
<nav data-toc></nav>
|
|
209
|
+
</aside>
|
|
210
|
+
</div>
|
|
211
|
+
<script>
|
|
212
|
+
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
|
|
213
|
+
</script>
|
|
214
|
+
<script defer src="/_vercel/insights/script.js"></script>
|
|
215
|
+
</body>
|
|
216
|
+
</html>
|
package/docs-site/workflows.html
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<span>Pi Agent Platform</span>
|
|
31
31
|
</a>
|
|
32
32
|
<div class="top-actions">
|
|
33
|
-
<span class="pill"><span class="pill-dot"></span>v1.
|
|
33
|
+
<span class="pill"><span class="pill-dot"></span>v1.15.0 docs · VI</span>
|
|
34
34
|
<nav class="language-switch" aria-label="Ngôn ngữ">
|
|
35
35
|
<a class="language-option current" href="/workflows" hreflang="vi" lang="vi" aria-current="true">VI</a>
|
|
36
36
|
<a class="language-option" href="/en/workflows" hreflang="en" lang="en">EN</a>
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
<a class="nav-link" href="/">Overview</a>
|
|
62
62
|
<a class="nav-link" href="/ecosystem">Hệ sinh thái</a>
|
|
63
63
|
<a class="nav-link" href="/quickstart">Quickstart</a>
|
|
64
|
+
<a class="nav-link" href="/windows">Cài trên Windows</a>
|
|
64
65
|
<a class="nav-link" href="/whats-new">Có gì mới</a>
|
|
65
66
|
<a class="nav-link" href="/scope">Phạm vi platform</a>
|
|
66
67
|
</div>
|
|
@@ -256,8 +256,8 @@
|
|
|
256
256
|
},
|
|
257
257
|
{
|
|
258
258
|
"path": "tests",
|
|
259
|
-
"fileCount":
|
|
260
|
-
"sha256": "
|
|
259
|
+
"fileCount": 523,
|
|
260
|
+
"sha256": "7a915f36ce5d1c156d838eb5bbeba84db83e26fc092b77328006aecf6b53b3b8"
|
|
261
261
|
}
|
|
262
262
|
],
|
|
263
263
|
"custodianComparisonRules": {
|
package/package.json
CHANGED
|
@@ -26,7 +26,13 @@ export class ManagedBrokerClient {
|
|
|
26
26
|
const result = JSON.parse(line), item = this.#pending.get(result.id);
|
|
27
27
|
if (!item) throw Error('unexpected-broker-response');
|
|
28
28
|
clearTimeout(item.timer); this.#pending.delete(result.id);
|
|
29
|
-
if (result.error)
|
|
29
|
+
if (result.error) {
|
|
30
|
+
// Agent Watch's coarse error stays the message (start and renewal
|
|
31
|
+
// decide on it); Studio's own reason rides along for the member.
|
|
32
|
+
const error = Error(`managed-broker:${String(result.error).replace(/[^a-zA-Z_]/g, '').slice(0, 80)}`);
|
|
33
|
+
if (typeof result.studio_code === 'string' && /^[a-z0-9_]{1,64}$/.test(result.studio_code)) error.studioCode = result.studio_code;
|
|
34
|
+
item.reject(error);
|
|
35
|
+
}
|
|
30
36
|
else item.resolve(result.result);
|
|
31
37
|
} catch { this.#child.kill(); fail(); }
|
|
32
38
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { ManagedToolBoundary } from './tool-boundary.mjs';
|
|
7
7
|
import { managedResourceLoader } from './resource-loader.mjs';
|
|
8
8
|
import { shareGrant, releaseGrant } from './grant-share.mjs';
|
|
9
|
-
import { describeFailure, failureCode } from '../runtime/managed-failure.mjs';
|
|
9
|
+
import { describeFailure, failureCode, failureText } from '../runtime/managed-failure.mjs';
|
|
10
10
|
import { reviewParts, mergeReviews, REVIEW_PARALLEL } from './patch-snapshot.mjs';
|
|
11
11
|
import { reviewFindings, briefIssues } from './workflow.mjs';
|
|
12
12
|
import { anchorText, relayObjection, recordVerdicts } from './objections.mjs';
|
|
@@ -48,7 +48,7 @@ async function helperAttempt(managed, role, task, signal, harness, snapshot, par
|
|
|
48
48
|
managed.helperCalls.set(role, (managed.helperCalls.get(role) ?? 0) + 1);
|
|
49
49
|
try { verifyGrant(grant, managed.manifest, role); }
|
|
50
50
|
catch (error) { try { await managed.broker.request('close', { role }); } catch { /* closes with the run */ } throw error; }
|
|
51
|
-
} catch (error) { throw Error(`managed-helper-failed: ${describeFailure(role, error
|
|
51
|
+
} catch (error) { throw Error(`managed-helper-failed: ${describeFailure(role, failureText(error))}`); }
|
|
52
52
|
let boundary;
|
|
53
53
|
const sessions = new Set();
|
|
54
54
|
try {
|
|
@@ -10,6 +10,9 @@ export function sandboxDiagnostic(message, { network = false, isolated = false }
|
|
|
10
10
|
if(network&&!DENIAL.test(text)&&OFFLINE.test(text))return 'managed-network-unreachable: Lệnh đã được duyệt và chạy có mạng nhưng không tới được host (máy đang offline, cần VPN/proxy công ty, hoặc sai tên host). Không xin duyệt lại cùng lệnh; báo người dùng lỗi mạng này.\n'+text;
|
|
11
11
|
if(!DENIAL.test(text)&&OFFLINE.test(text))return 'managed-network-blocked: Lệnh bash thường không có mạng trong chế độ công ty. Nếu lệnh thật sự cần mạng (cài package, tải dữ liệu), dùng run_with_network để người dùng duyệt đúng lệnh đó.\n'+text;
|
|
12
12
|
if(!DENIAL.test(text))return text;
|
|
13
|
+
// /tmp is shared by every process on the Mac, so it stays read-only; each
|
|
14
|
+
// command has its own temporary folder in $TMPDIR (Linux: a private /tmp).
|
|
15
|
+
if(/(?:^|[\s'"=:(])\/(?:private\/)?tmp\//.test(text))return 'managed-sandbox-denied: /tmp chỉ được đọc trong chế độ công ty. Ghi file tạm (log, kết quả test) vào "$TMPDIR" (thư mục tạm riêng của lệnh, ví dụ "$TMPDIR/test.log") hoặc trong project. Không tự chạy lại bên ngoài sandbox.\n'+text;
|
|
13
16
|
return 'managed-sandbox-denied: Công cụ bị giới hạn quyền trong chế độ công ty (hoặc quyền file của hệ điều hành). Keychain và file chứa credential như .env/.npmrc bị chặn. Lệnh cần mạng (cài package, tải dữ liệu) dùng run_with_network để xin duyệt; git fetch origin dùng fetch_origin. Không tự chạy lại bên ngoài sandbox.\n'+text;
|
|
14
17
|
}
|
|
15
18
|
|
|
@@ -11,7 +11,7 @@ import { shareGrant, releaseGrant } from './grant-share.mjs';
|
|
|
11
11
|
import { managedThinkingLevels, nearestLevel } from './capabilities.mjs';
|
|
12
12
|
import { nativeManagedModel, isVendor, piProvider, studioAPI, studioPath } from './native-catalog.mjs';
|
|
13
13
|
import { repositoryFetchPlan, executeRepositoryFetch } from './repository-operation.mjs';
|
|
14
|
-
import { describeFailure, failureCode } from '../runtime/managed-failure.mjs';
|
|
14
|
+
import { describeFailure, failureCode, failureText } from '../runtime/managed-failure.mjs';
|
|
15
15
|
import { wrapRoleStreams } from './request-stream.mjs';
|
|
16
16
|
import { runHelper } from './helper-run.mjs';
|
|
17
17
|
import { askTool } from './member-questions.mjs';
|
|
@@ -268,7 +268,7 @@ export class ManagedSession {
|
|
|
268
268
|
});
|
|
269
269
|
self.run = new RunProcess(workflowPolicy(self.manifest), { request: text, complex: taskClass(text) === 'complex', checks: self.checks });
|
|
270
270
|
self.run.startDigest = pendingBaseline(manager) ?? await self.digest();
|
|
271
|
-
} catch (error) { self.preflight = describeFailure('main', error
|
|
271
|
+
} catch (error) { self.preflight = describeFailure('main', failureText(error)); }
|
|
272
272
|
self.activePrompt = true;
|
|
273
273
|
})();
|
|
274
274
|
try { await self.starting; } finally { self.starting = null; }
|
|
@@ -313,7 +313,11 @@ export class ManagedToolBoundary {
|
|
|
313
313
|
signal?.addEventListener('abort', abort, { once: true });
|
|
314
314
|
child.stdin.on('error', () => {});
|
|
315
315
|
child.stdout.on('data', chunk => {
|
|
316
|
-
|
|
316
|
+
// The cap is per message, not per command: a noisy command streams a
|
|
317
|
+
// progress update (the output's last 50KB) every 100ms, so a running
|
|
318
|
+
// total would stop any build or test that prints for ~25 seconds.
|
|
319
|
+
const newline = chunk.lastIndexOf(10);
|
|
320
|
+
bytes = newline < 0 ? bytes + chunk.length : chunk.length - newline - 1;
|
|
317
321
|
if (bytes > MAX_WIRE_BYTES) { failure = new Error('managed-tool-output-too-large'); terminate(); return; }
|
|
318
322
|
pending += decoder.write(chunk);
|
|
319
323
|
for (;;) {
|
|
@@ -35,7 +35,8 @@ const CODES = {
|
|
|
35
35
|
policy_denied: ['policy', 'this key may not use this model, thinking level or output size'],
|
|
36
36
|
thinking_level_unavailable: ['policy', 'this thinking level is not available for the harness'],
|
|
37
37
|
harness_model_unsupported: ['policy', 'the harness uses a model Studio cannot run'],
|
|
38
|
-
harness_profile_unavailable: ['policy',
|
|
38
|
+
harness_profile_unavailable: ['policy', "the team's harness has no model for this role"],
|
|
39
|
+
harness_route_unavailable: ['provider-limit', "no company model account serves this role's model for the team right now; an administrator has to link or enable one in Studio"],
|
|
39
40
|
execution_capability_unavailable: ['policy', 'no company model account can run this model'],
|
|
40
41
|
session_account_unavailable_start_new_session: ['new-session', "this conversation's model account is gone"],
|
|
41
42
|
run_state_conflict: ['config-changed', 'this run was closed or replaced'],
|
|
@@ -149,6 +150,13 @@ export function failureCode(raw) {
|
|
|
149
150
|
return 'managed-request-failed';
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
// An error's text with Studio's own reason for a refusal Agent Watch passed
|
|
154
|
+
// on (error.studioCode), in the shape failureCode reads first.
|
|
155
|
+
export function failureText(error) {
|
|
156
|
+
const text = String(error?.message ?? error ?? '');
|
|
157
|
+
return typeof error?.studioCode === 'string' ? `${text} {"code":"${error.studioCode}"}` : text;
|
|
158
|
+
}
|
|
159
|
+
|
|
152
160
|
// "Agent Watch main agent: <what failed> [code] (request <id>)". The role says
|
|
153
161
|
// who failed; the model behind it is the harness's business, not the reader's.
|
|
154
162
|
export function describeFailure(role, raw) {
|