@piagent/platform 1.15.2 → 1.16.1
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 +1 -1
- package/README.vi.md +1 -1
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/languages.json +2 -2
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +3 -1
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/content/en/index.html +4 -4
- package/docs-site/content/en/whats-new.html +22 -0
- package/docs-site/content/index.html +4 -4
- package/docs-site/content/whats-new.html +22 -0
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +5 -5
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/whats-new.html +23 -1
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +5 -5
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/whats-new.html +23 -1
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
- package/package.json +1 -1
- package/packages/piagent-core/extensions/piagent-guard.ts +8 -1
- package/packages/piagent-core/extensions/update-check.js +2 -2
- package/packages/piagent-core/managed/permission.mjs +22 -0
- package/packages/piagent-core/managed/session.mjs +15 -7
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/runtime/policy/bypass-policy.mjs +42 -0
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-DjA3OGyI.js → MarkdownMessage-sL0LOqY0.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/index-Bs8l37SR.js +228 -0
- package/packages/piagent-webui/dist/client/index.html +1 -1
- package/packages/piagent-webui/gateway/gateway-service.ts +2 -1
- package/packages/piagent-webui/gateway/managed-projection.ts +3 -1
- package/packages/piagent-webui/gateway/runtime-session-controls.ts +7 -1
- package/packages/piagent-webui/gateway/session-catalog.ts +3 -2
- package/packages/piagent-webui/gateway/update-center.ts +3 -2
- package/packages/piagent-webui/server/loopback-server.ts +1 -0
- package/packages/piagent-webui/server/session-auth.ts +13 -2
- package/schemas/piagent-webui/session-catalog-v1.schema.json +1 -1
- package/packages/piagent-webui/dist/client/assets/index-bE2DKmc1.js +0 -228
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="csp-nonce" content="__PIAGENT_CSP_NONCE__" />
|
|
8
8
|
<meta name="piagent-webui-mode" content="__PIAGENT_WEBUI_MODE__" />
|
|
9
9
|
<title>Piagent WebUI</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-Bs8l37SR.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-Z91z6SlN.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
@@ -71,7 +71,8 @@ function capabilities(gatewayInstanceRef: string, runtimeAvailable = false, mana
|
|
|
71
71
|
abort: runtimeAvailable ? available() : unavailable("session-runtime-not-enabled"),
|
|
72
72
|
setModel: runtimeAvailable && !managed ? available() : unavailable("model-managed-by-studio"),
|
|
73
73
|
setThinking: runtimeAvailable ? available() : unavailable("session-runtime-not-enabled"),
|
|
74
|
-
|
|
74
|
+
// A company conversation offers "Ask first" or Bypass (no read-only).
|
|
75
|
+
setPermission: runtimeAvailable ? available() : unavailable("session-runtime-not-enabled"),
|
|
75
76
|
rename: runtimeAvailable ? available() : unavailable("session-runtime-not-enabled"),
|
|
76
77
|
pin: runtimeAvailable ? available() : unavailable("session-runtime-not-enabled"),
|
|
77
78
|
archive: runtimeAvailable ? available() : unavailable("session-runtime-not-enabled"),
|
|
@@ -17,7 +17,9 @@ export function managedProjection(context: any, entries: any[]) {
|
|
|
17
17
|
// Helpers the Harness enables (up to four); a conversation recorded before
|
|
18
18
|
// that was known says two.
|
|
19
19
|
const maximum = Number.isInteger(counter?.maximum) && counter.maximum >= 0 && counter.maximum <= 4 ? counter.maximum : 2;
|
|
20
|
-
|
|
20
|
+
// The member's access choice: "trusted-full-access" is Bypass.
|
|
21
|
+
const permission = last('agent-watch-permission')?.mode === 'trusted-full-access' ? 'trusted-full-access' : 'workspace-write';
|
|
22
|
+
return {modelLabel:'agent-watch-auto', managedPermission: permission, managedHelpers:{active:Number.isInteger(counter?.active) && counter.active>=0 && counter.active<=maximum ? counter.active : 0, maximum},
|
|
21
23
|
...(Array.isArray(capabilities)?{managedThinkingLevels:levels.filter(level=>capabilities.includes(level))}:{}),
|
|
22
24
|
...(steps ? {managedPlan:{steps}} : {}), ...(process ? {managedProcess:process} : {})};
|
|
23
25
|
}
|
|
@@ -15,7 +15,13 @@ type RuntimeCommandOutput = {
|
|
|
15
15
|
|
|
16
16
|
export async function executePermissionCommand(session: any,
|
|
17
17
|
permissionMode: "read-only" | "workspace-write" | "trusted-full-access"): Promise<void> {
|
|
18
|
-
|
|
18
|
+
// A company conversation: "Ask first" or "Bypass" (no read-only mode); the
|
|
19
|
+
// runtime keeps the choice in the conversation.
|
|
20
|
+
if (session.managedExecution) {
|
|
21
|
+
if (typeof session.managedSetPermission !== "function" || permissionMode === "read-only") throw new Error("managed-permission-unavailable");
|
|
22
|
+
session.managedSetPermission(permissionMode);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
19
25
|
const before = Array.isArray(session.messages) ? session.messages.length : 0;
|
|
20
26
|
await session.prompt(`/permission ${permissionMode}`);
|
|
21
27
|
const messages = Array.isArray(session.messages) ? session.messages.slice(before) : [];
|
|
@@ -47,7 +47,7 @@ function catalogRef(key: Buffer, namespace: string, value: string): string {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export type SessionOwnerProjection = Pick<SessionRow, "state" | "liveState" | "composerAvailable" | "needsAttention" | "owner" | "reasonCode">;
|
|
50
|
-
export type SessionOptionProjection = Pick<SessionRow, "modelLabel" | "thinkingLevel" | "managedHelpers" | "managedThinkingLevels" | "managedPlan" | "managedProcess">;
|
|
50
|
+
export type SessionOptionProjection = Pick<SessionRow, "modelLabel" | "thinkingLevel" | "managedHelpers" | "managedThinkingLevels" | "managedPermission" | "managedPlan" | "managedProcess">;
|
|
51
51
|
|
|
52
52
|
function display(value: unknown, maximum: number, fallback: string): string {
|
|
53
53
|
const clean = redactSensitiveText(String(value ?? "")).text
|
|
@@ -126,6 +126,7 @@ function row(key: Buffer, info: PiSessionInfo, metadata: SessionMetadata | undef
|
|
|
126
126
|
...(sessionOptions?.managedHelpers ? {managedHelpers:{...sessionOptions.managedHelpers,
|
|
127
127
|
active: ownership?.liveState === 'idle' ? 0 : ownership?.liveState === 'running' || ownership?.liveState === 'waiting-approval' ? sessionOptions.managedHelpers.active : null}} : {}),
|
|
128
128
|
...(sessionOptions?.managedThinkingLevels ? {managedThinkingLevels:sessionOptions.managedThinkingLevels} : {}),
|
|
129
|
+
...(sessionOptions?.managedPermission ? {managedPermission:sessionOptions.managedPermission} : {}),
|
|
129
130
|
...(sessionOptions?.managedPlan ? {managedPlan:sessionOptions.managedPlan} : {}),
|
|
130
131
|
...(sessionOptions?.managedProcess ? {managedProcess:sessionOptions.managedProcess} : {}),
|
|
131
132
|
modelLabel: sessionOptions?.modelLabel ?? null,
|
|
@@ -136,7 +137,7 @@ function row(key: Buffer, info: PiSessionInfo, metadata: SessionMetadata | undef
|
|
|
136
137
|
? { kind: "none", ownerEpoch: null, gatewayInstanceRef: null, runtimeInstanceRef: null, continuity: "released" }
|
|
137
138
|
: ownership?.owner ?? { kind: "none", ownerEpoch: null, gatewayInstanceRef: null, runtimeInstanceRef: null, continuity: "unknown" },
|
|
138
139
|
sessionRevision: revision(key, [info.path, info.modified.toISOString(), info.messageCount, info.name ?? null, metadata?.revision ?? null,
|
|
139
|
-
sessionOptions?.modelLabel ?? null, sessionOptions?.thinkingLevel ?? "unknown", sessionOptions?.managedHelpers, sessionOptions?.managedThinkingLevels, sessionOptions?.managedPlan, sessionOptions?.managedProcess,
|
|
140
|
+
sessionOptions?.modelLabel ?? null, sessionOptions?.thinkingLevel ?? "unknown", sessionOptions?.managedHelpers, sessionOptions?.managedThinkingLevels, sessionOptions?.managedPermission ?? null, sessionOptions?.managedPlan, sessionOptions?.managedProcess,
|
|
140
141
|
metadata?.archived ? "archived" : ownership ? [ownership.state, ownership.liveState, ownership.owner.kind,
|
|
141
142
|
ownership.owner.ownerEpoch, ownership.owner.runtimeInstanceRef, ownership.reasonCode] : "offline"]),
|
|
142
143
|
reasonCode: metadata?.archived ? metadataReason : ownership?.reasonCode ?? metadataReason
|
|
@@ -10,13 +10,14 @@ import { compareReleaseVersions, releaseVersion, writeUpdateCache } from "../../
|
|
|
10
10
|
// past the version the newest Piagent pins (its peer dependency): that is the
|
|
11
11
|
// host its managed runtime is qualified on. A newer Pi is shown as untested.
|
|
12
12
|
//
|
|
13
|
-
// The registry is asked in the background, at most every
|
|
13
|
+
// The registry is asked in the background, at most every hour unless the
|
|
14
14
|
// member asks now; the dashboard reads the cached answer. Everything read from
|
|
15
15
|
// outside (registry answers, the cache and job files any local process could
|
|
16
16
|
// write) is accepted only as release versions and known codes.
|
|
17
17
|
const PLATFORM = "@piagent/platform";
|
|
18
18
|
const HOST = "@earendil-works/pi-coding-agent";
|
|
19
|
-
|
|
19
|
+
// Releases ship several times a day; members should hear within the hour.
|
|
20
|
+
export const CHECK_EVERY_MS = 60 * 60 * 1000;
|
|
20
21
|
const FORCED_CHECK_GAP_MS = 30_000;
|
|
21
22
|
const PROBE_TIMEOUT_MS = 20_000;
|
|
22
23
|
const MAX_FILE_BYTES = 4096;
|
|
@@ -448,6 +448,7 @@ export async function startLoopbackServer(options: {
|
|
|
448
448
|
});
|
|
449
449
|
const address = server.address();
|
|
450
450
|
if (!address || typeof address === "string" || address.address !== "127.0.0.1") { server.close(); throw new Error("loopback-bind-failed"); }
|
|
451
|
+
auth.bindPort(address.port);
|
|
451
452
|
origin = `http://127.0.0.1:${address.port}`;
|
|
452
453
|
return {
|
|
453
454
|
origin,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import type { IncomingMessage } from "node:http";
|
|
3
3
|
|
|
4
|
+
// Cookies are scoped by host, not by port: every Piagent server on 127.0.0.1
|
|
5
|
+
// (the Gateway, a company service, an older launch) shares one cookie jar.
|
|
6
|
+
// The name carries the port once bound, so one server's launch no longer
|
|
7
|
+
// replaces the session of another server's open tab.
|
|
4
8
|
const SESSION_COOKIE = "piagent_webui_session";
|
|
5
9
|
|
|
6
10
|
function secret(): string { return randomBytes(32).toString("base64url"); }
|
|
@@ -23,6 +27,7 @@ export class SessionAuthority {
|
|
|
23
27
|
readonly #bootstrapTtlMs: number;
|
|
24
28
|
readonly #sessionTtlMs: number;
|
|
25
29
|
readonly #cookieSigningKey = randomBytes(32);
|
|
30
|
+
#cookieName = SESSION_COOKIE;
|
|
26
31
|
#bootstraps = new Map<string, number>();
|
|
27
32
|
#sessions = new Map<string, BrowserSession>();
|
|
28
33
|
|
|
@@ -33,6 +38,12 @@ export class SessionAuthority {
|
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
get bootstrapCapability(): string { return this.#initialBootstrap; }
|
|
41
|
+
get cookieName(): string { return this.#cookieName; }
|
|
42
|
+
|
|
43
|
+
bindPort(port: number): void {
|
|
44
|
+
if (!Number.isInteger(port) || port < 1 || port > 65_535) throw new Error("invalid-session-port");
|
|
45
|
+
this.#cookieName = `${SESSION_COOKIE}_${port}`;
|
|
46
|
+
}
|
|
36
47
|
|
|
37
48
|
issueBootstrapCapability(now = Date.now()): string {
|
|
38
49
|
for (const [value, createdAt] of this.#bootstraps) {
|
|
@@ -54,7 +65,7 @@ export class SessionAuthority {
|
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
authenticate(request: IncomingMessage, now = Date.now()): BrowserSession | null {
|
|
57
|
-
const value = cookie(request,
|
|
68
|
+
const value = cookie(request, this.#cookieName);
|
|
58
69
|
if (!value) return null;
|
|
59
70
|
const separator = value.lastIndexOf(".");
|
|
60
71
|
if (separator < 1) return null;
|
|
@@ -77,7 +88,7 @@ export class SessionAuthority {
|
|
|
77
88
|
cookieHeader(session: BrowserSession): string {
|
|
78
89
|
const seconds = Math.max(1, Math.floor((session.expiresAt - Date.now()) / 1000));
|
|
79
90
|
const token = `${session.id}.${this.#cookieSignature(session.id)}`;
|
|
80
|
-
return `${
|
|
91
|
+
return `${this.#cookieName}=${token}; HttpOnly; SameSite=Strict; Path=/; Max-Age=${seconds}`;
|
|
81
92
|
}
|
|
82
93
|
|
|
83
94
|
#cookieSignature(id: string): string {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"composerAvailable": { "type": "boolean" },
|
|
93
93
|
"needsAttention": { "type": "boolean" },
|
|
94
94
|
"managedHelpers": { "type": "object", "additionalProperties": false, "required": ["active", "maximum"], "properties": {"active": {"type": ["integer", "null"], "minimum": 0, "maximum": 4}, "maximum": {"type": "integer", "minimum": 0, "maximum": 4}} },
|
|
95
|
-
"managedThinkingLevels": {"type": "array", "uniqueItems": true, "maxItems": 7, "items": {"enum": ["off","minimal","low","medium","high","xhigh","max"]}},
|
|
95
|
+
"managedThinkingLevels": {"type": "array", "uniqueItems": true, "maxItems": 7, "items": {"enum": ["off","minimal","low","medium","high","xhigh","max"]}}, "managedPermission": {"enum": ["workspace-write","trusted-full-access"]},
|
|
96
96
|
"managedPlan": { "type": "object", "additionalProperties": false, "required": ["steps"], "properties": {
|
|
97
97
|
"steps": { "type": "array", "minItems": 1, "maxItems": 30, "items": { "type": "object", "additionalProperties": false, "required": ["step", "status"], "properties": {
|
|
98
98
|
"step": { "type": "string", "minLength": 1, "maxLength": 200 }, "status": { "enum": ["pending", "in_progress", "completed"] } } } } } },
|