pi-harness-runtime 1.1.387 → 1.1.388
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/AGENTS.md +9 -4
- package/index.ts +20 -18
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/connection-runtime/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/contracts/dist/workspace-env-format.d.ts +71 -0
- package/packages/contracts/dist/workspace-env-format.js +120 -0
- package/packages/contracts/dist/workspace-env.d.ts +7 -30
- package/packages/contracts/dist/workspace-env.js +18 -57
- package/packages/contracts/package.json +1 -1
- package/packages/contracts/src/workspace-env-format.ts +165 -0
- package/packages/contracts/src/workspace-env.ts +27 -99
- package/packages/contracts/test/workspace-env.test.ts +144 -0
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/durable-review/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-sink/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/package.json +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/permission-mode/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/relay/dist/index.d.ts +3 -0
- package/packages/relay/dist/index.js +3 -0
- package/packages/relay/dist/relay-endpoint.d.ts +94 -0
- package/packages/relay/dist/relay-endpoint.js +239 -0
- package/packages/relay/package.json +1 -1
- package/packages/relay/src/index.ts +17 -0
- package/packages/relay/src/relay-endpoint.ts +304 -0
- package/packages/relay/test/relay-endpoint.test.ts +278 -0
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/telegram/package.json +1 -1
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/tui/test/harness-footer.test.ts +1 -1
- package/packages/types/package.json +1 -1
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/write-review/package.json +1 -1
- package/scripts/relay-client.ts +24 -4
- package/scripts/unified-webhook-server.ts +29 -22
|
@@ -76,7 +76,7 @@ function makeSessionInfo(overrides: Partial<FooterSessionInfo> = {}): FooterSess
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
const QUOTA = "MiniMax: 5h: 98% left (resets 3 hr 15 min) - week: 85% left";
|
|
79
|
-
const WORKSPACE = "Workspace:
|
|
79
|
+
const WORKSPACE = "Workspace: DEVELOPMENT | dev server: running | build: not running (script available) | RAM: 6.4/15";
|
|
80
80
|
|
|
81
81
|
// ---------------------------------------------------------------------------
|
|
82
82
|
// Tests
|
package/scripts/relay-client.ts
CHANGED
|
@@ -8,20 +8,31 @@
|
|
|
8
8
|
* - Typed message handling
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
* RELAY_WS_URL=wss://webhook.bunchee.online:8444 \
|
|
12
|
-
* RELAY_AUTH_TOKEN=change-me-in-production \
|
|
13
11
|
* bun run scripts/relay-client.ts
|
|
12
|
+
*
|
|
13
|
+
* The endpoint and the token are resolved from the environment and the key
|
|
14
|
+
* files (see resolveRelayEndpoint); no URL or token has to be passed in.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
17
18
|
import { join } from "path";
|
|
18
19
|
import { homedir } from "os";
|
|
19
20
|
import { RelayClient } from "../packages/relay/src/client";
|
|
21
|
+
import { describeRelayEndpoint, resolveRelayEndpoint } from "../packages/relay/src/relay-endpoint";
|
|
20
22
|
import type { CallbackPayload, SnapshotMessage } from "../packages/relay/src/types";
|
|
21
23
|
|
|
22
24
|
// Configuration
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
// The relay endpoint is resolved from the SAME sources the relay server uses
|
|
26
|
+
// (env -> dedicated key file -> the telegram webhook url/secret), so the
|
|
27
|
+
// client and the server always agree on the URL and the token.
|
|
28
|
+
// The token value is never logged - only the source it came from.
|
|
29
|
+
const KEYS_DIR = join(homedir(), ".pi-harness-runtime", "keys");
|
|
30
|
+
const RELAY_ENDPOINT = resolveRelayEndpoint({ keysDir: KEYS_DIR });
|
|
31
|
+
// The resolver already consulted the environment - a value it rejected must
|
|
32
|
+
// NOT be re-used here, otherwise the client would connect to an endpoint the
|
|
33
|
+
// resolver deliberately skipped.
|
|
34
|
+
const RELAY_WS_URL = RELAY_ENDPOINT.url ?? "";
|
|
35
|
+
const RELAY_AUTH_TOKEN = RELAY_ENDPOINT.token ?? "";
|
|
25
36
|
const JOB_PIPE_FILE = join(homedir(), ".pi-harness-runtime", "job-commands.jsonl");
|
|
26
37
|
|
|
27
38
|
// ============================================================================
|
|
@@ -96,10 +107,19 @@ async function processCallback(callback: CallbackPayload): Promise<void> {
|
|
|
96
107
|
// ============================================================================
|
|
97
108
|
|
|
98
109
|
async function main() {
|
|
110
|
+
// Validate BEFORE printing the banner - an unconfigured run must not print
|
|
111
|
+
// an empty "Server:" line.
|
|
112
|
+
if (!RELAY_WS_URL || !RELAY_AUTH_TOKEN) {
|
|
113
|
+
console.error("[Client] Relay endpoint not configured");
|
|
114
|
+
console.error(`[Client] ${RELAY_ENDPOINT.missing.join("; ")}`);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
99
118
|
console.log("===========================================");
|
|
100
119
|
console.log("Real-time Callback Relay Client - Streaming v2");
|
|
101
120
|
console.log("===========================================");
|
|
102
121
|
console.log(`Server: ${RELAY_WS_URL}`);
|
|
122
|
+
console.log(`Endpoint: ${describeRelayEndpoint(RELAY_ENDPOINT)}`);
|
|
103
123
|
console.log("===========================================");
|
|
104
124
|
|
|
105
125
|
// Create client with typed callbacks
|
|
@@ -22,6 +22,7 @@ import { join } from "node:path";
|
|
|
22
22
|
import { homedir } from "os";
|
|
23
23
|
import { createServer, IncomingMessage, ServerResponse } from "node:http";
|
|
24
24
|
import { createRelayServer } from "../packages/relay/src/server";
|
|
25
|
+
import { resolveRelayEndpoint } from "../packages/relay/src/relay-endpoint";
|
|
25
26
|
import { generateMessageId } from "../packages/relay/src/types";
|
|
26
27
|
import type { CallbackPayload } from "../packages/relay/src/types";
|
|
27
28
|
import type { RelayServerOptions } from "../packages/relay/src/server";
|
|
@@ -37,8 +38,8 @@ interface Config {
|
|
|
37
38
|
accessToken: string;
|
|
38
39
|
channelSecret: string;
|
|
39
40
|
};
|
|
40
|
-
/** Relay auth token used by WebSocket clients. */
|
|
41
|
-
relayAuthToken: string;
|
|
41
|
+
/** Relay auth token used by WebSocket clients (null = relay stays off). */
|
|
42
|
+
relayAuthToken: string | null;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const PORT = parseInt(process.env.PORT || "8443", 10);
|
|
@@ -46,24 +47,17 @@ const WS_PORT = parseInt(process.env.WS_PORT || "8444", 10);
|
|
|
46
47
|
/**
|
|
47
48
|
* Resolve the relay auth token.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
50
|
+
* The chain lives in packages/relay/src/relay-endpoint.ts and is SHARED with
|
|
51
|
+
* the relay client, so the two sides can never disagree about the credential:
|
|
52
|
+
* RELAY_AUTH_TOKEN env -> keys/relay-auth-token.txt ->
|
|
53
|
+
* keys/telegram-webhook-secret.txt.
|
|
51
54
|
*
|
|
52
|
-
* Never hardcode a real token here; secrets live in key files.
|
|
55
|
+
* Never hardcode a real token here; secrets live in key files. When no token
|
|
56
|
+
* can be found the relay is NOT started at all - a placeholder token would
|
|
57
|
+
* let anyone who knows it connect to the relay.
|
|
53
58
|
*/
|
|
54
|
-
function resolveAuthToken(keysDir: string): string {
|
|
55
|
-
|
|
56
|
-
if (fromEnv) return fromEnv;
|
|
57
|
-
|
|
58
|
-
for (const name of ["relay-auth-token.txt", "telegram-webhook-secret.txt"]) {
|
|
59
|
-
const path = join(keysDir, name);
|
|
60
|
-
if (existsSync(path)) {
|
|
61
|
-
const value = readFileSync(path, "utf-8").trim();
|
|
62
|
-
if (value) return value;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return "change-me-in-production";
|
|
59
|
+
function resolveAuthToken(keysDir: string): string | null {
|
|
60
|
+
return resolveRelayEndpoint({ keysDir }).token;
|
|
67
61
|
}
|
|
68
62
|
const SERVER_VERSION = process.env.SERVER_VERSION || "1.0.0";
|
|
69
63
|
|
|
@@ -377,14 +371,19 @@ async function main() {
|
|
|
377
371
|
if (config.telegram) console.log(" /telegram - Telegram webhook");
|
|
378
372
|
if (config.line) console.log(" /line - LINE webhook");
|
|
379
373
|
console.log(` HTTP: http://0.0.0.0:${PORT}`);
|
|
380
|
-
console.log(
|
|
374
|
+
console.log(
|
|
375
|
+
config.relayAuthToken
|
|
376
|
+
? ` WebSocket: ws://0.0.0.0:${WS_PORT}`
|
|
377
|
+
: ` WebSocket: disabled (no relay auth token configured)`,
|
|
378
|
+
);
|
|
381
379
|
console.log("===========================================");
|
|
382
380
|
|
|
383
381
|
// Create relay server with typed streaming
|
|
384
382
|
const relayOptions: RelayServerOptions = {
|
|
385
383
|
port: WS_PORT,
|
|
386
384
|
host: "0.0.0.0",
|
|
387
|
-
|
|
385
|
+
// Without a configured token the relay is never started - see below.
|
|
386
|
+
authToken: config.relayAuthToken ?? "",
|
|
388
387
|
serverVersion: SERVER_VERSION,
|
|
389
388
|
onStateChange: (change: { previous: { state: string }; current: { state: string }; timestamp: string }) => {
|
|
390
389
|
console.log(`[Relay] State: ${change.previous.state} → ${change.current.state}`);
|
|
@@ -394,8 +393,16 @@ async function main() {
|
|
|
394
393
|
const relayServer = createRelayServer(relayOptions);
|
|
395
394
|
|
|
396
395
|
// Start WebSocket relay
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
if (config.relayAuthToken) {
|
|
397
|
+
await relayServer.start();
|
|
398
|
+
console.log("[Relay] WebSocket server started on port", WS_PORT);
|
|
399
|
+
} else {
|
|
400
|
+
// Fail closed: without a secret no client may connect. The HTTP webhook
|
|
401
|
+
// keeps working and the callbacks are queued on disk instead.
|
|
402
|
+
console.error(
|
|
403
|
+
"[Relay] No relay auth token configured (RELAY_AUTH_TOKEN, keys/relay-auth-token.txt or keys/telegram-webhook-secret.txt) - the relay WebSocket server will NOT start; callbacks are queued on disk.",
|
|
404
|
+
);
|
|
405
|
+
}
|
|
399
406
|
|
|
400
407
|
// HTTP webhook server
|
|
401
408
|
const server = createServer(async (req, res) => {
|