pi-harness-runtime 1.1.396 → 1.1.397
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 +54 -7
- 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/package.json +1 -1
- 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/logging/README.md +41 -6
- package/packages/logging/dist/classification.d.ts +65 -0
- package/packages/logging/dist/classification.d.ts.map +1 -0
- package/packages/logging/dist/classification.js +155 -0
- package/packages/logging/dist/classification.js.map +1 -0
- package/packages/logging/dist/config.d.ts +9 -0
- package/packages/logging/dist/config.d.ts.map +1 -1
- package/packages/logging/dist/config.js +40 -3
- package/packages/logging/dist/config.js.map +1 -1
- package/packages/logging/dist/index.d.ts +9 -1
- package/packages/logging/dist/index.d.ts.map +1 -1
- package/packages/logging/dist/index.js +10 -1
- package/packages/logging/dist/index.js.map +1 -1
- package/packages/logging/dist/ingest/schema.d.ts +60 -0
- package/packages/logging/dist/ingest/schema.d.ts.map +1 -0
- package/packages/logging/dist/ingest/schema.js +245 -0
- package/packages/logging/dist/ingest/schema.js.map +1 -0
- package/packages/logging/dist/installation.d.ts +32 -0
- package/packages/logging/dist/installation.d.ts.map +1 -0
- package/packages/logging/dist/installation.js +64 -0
- package/packages/logging/dist/installation.js.map +1 -0
- package/packages/logging/dist/sensitive-keys.d.ts +12 -0
- package/packages/logging/dist/sensitive-keys.d.ts.map +1 -0
- package/packages/logging/dist/sensitive-keys.js +39 -0
- package/packages/logging/dist/sensitive-keys.js.map +1 -0
- package/packages/logging/dist/server/credentials.d.ts +85 -0
- package/packages/logging/dist/server/credentials.d.ts.map +1 -0
- package/packages/logging/dist/server/credentials.js +147 -0
- package/packages/logging/dist/server/credentials.js.map +1 -0
- package/packages/logging/dist/server/http.d.ts +36 -0
- package/packages/logging/dist/server/http.d.ts.map +1 -0
- package/packages/logging/dist/server/http.js +139 -0
- package/packages/logging/dist/server/http.js.map +1 -0
- package/packages/logging/dist/server/index-store.d.ts +95 -0
- package/packages/logging/dist/server/index-store.d.ts.map +1 -0
- package/packages/logging/dist/server/index-store.js +190 -0
- package/packages/logging/dist/server/index-store.js.map +1 -0
- package/packages/logging/dist/server/index.d.ts +22 -0
- package/packages/logging/dist/server/index.d.ts.map +1 -0
- package/packages/logging/dist/server/index.js +15 -0
- package/packages/logging/dist/server/index.js.map +1 -0
- package/packages/logging/dist/server/keys.d.ts +22 -0
- package/packages/logging/dist/server/keys.d.ts.map +1 -0
- package/packages/logging/dist/server/keys.js +24 -0
- package/packages/logging/dist/server/keys.js.map +1 -0
- package/packages/logging/dist/server/outbox-worker.d.ts +55 -0
- package/packages/logging/dist/server/outbox-worker.d.ts.map +1 -0
- package/packages/logging/dist/server/outbox-worker.js +95 -0
- package/packages/logging/dist/server/outbox-worker.js.map +1 -0
- package/packages/logging/dist/server/outbox.d.ts +112 -0
- package/packages/logging/dist/server/outbox.d.ts.map +1 -0
- package/packages/logging/dist/server/outbox.js +247 -0
- package/packages/logging/dist/server/outbox.js.map +1 -0
- package/packages/logging/dist/server/service.d.ts +83 -0
- package/packages/logging/dist/server/service.d.ts.map +1 -0
- package/packages/logging/dist/server/service.js +144 -0
- package/packages/logging/dist/server/service.js.map +1 -0
- package/packages/logging/dist/shipper.d.ts +20 -4
- package/packages/logging/dist/shipper.d.ts.map +1 -1
- package/packages/logging/dist/shipper.js +31 -5
- package/packages/logging/dist/shipper.js.map +1 -1
- package/packages/logging/dist/singleton.d.ts.map +1 -1
- package/packages/logging/dist/singleton.js +3 -0
- package/packages/logging/dist/singleton.js.map +1 -1
- package/packages/logging/dist/types.d.ts +28 -1
- package/packages/logging/dist/types.d.ts.map +1 -1
- package/packages/logging/dist/types.js +8 -0
- package/packages/logging/dist/types.js.map +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/logging/src/classification.ts +175 -0
- package/packages/logging/src/config.ts +60 -3
- package/packages/logging/src/index.ts +45 -1
- package/packages/logging/src/ingest/schema.ts +295 -0
- package/packages/logging/src/installation.ts +76 -0
- package/packages/logging/src/sensitive-keys.ts +40 -0
- package/packages/logging/src/server/credentials.ts +198 -0
- package/packages/logging/src/server/http.ts +170 -0
- package/packages/logging/src/server/index-store.ts +242 -0
- package/packages/logging/src/server/index.ts +56 -0
- package/packages/logging/src/server/keys.ts +32 -0
- package/packages/logging/src/server/outbox-worker.ts +124 -0
- package/packages/logging/src/server/outbox.ts +316 -0
- package/packages/logging/src/server/service.ts +196 -0
- package/packages/logging/src/shipper.ts +54 -8
- package/packages/logging/src/singleton.ts +3 -0
- package/packages/logging/src/types.ts +29 -1
- package/packages/logging/test/classification.test.ts +137 -0
- package/packages/logging/test/identity-transport.test.ts +197 -0
- package/packages/logging/test/ingest-schema.test.ts +184 -0
- package/packages/logging/test/integration.test.ts +9 -4
- package/packages/logging/test/log-http.test.ts +246 -0
- package/packages/logging/test/server.test.ts +444 -0
- package/packages/logging/test/shipper.test.ts +11 -11
- package/packages/logging/test/spool.test.ts +4 -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/package.json +1 -1
- 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/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/unified-webhook-server.ts +86 -81
package/AGENTS.md
CHANGED
|
@@ -648,20 +648,41 @@ Production detection ≠ deployment authorization
|
|
|
648
648
|
|
|
649
649
|
## Centralized Application Logging
|
|
650
650
|
|
|
651
|
-
All application logs can be shipped to **
|
|
652
|
-
|
|
653
|
-
(`@pi-harness/logging`); the harness uses the
|
|
651
|
+
All application logs can be shipped to the **unified webhook server** (ingest path),
|
|
652
|
+
which is the only component that writes to **Cloudflare R2** (durable archive). The
|
|
653
|
+
pipeline lives in `packages/logging` (`@pi-harness/logging`); the harness uses the
|
|
654
|
+
process-wide singleton from it.
|
|
654
655
|
|
|
655
|
-
**
|
|
656
|
+
**Client side** (first success wins, the rest are skipped - a fallback chain, never
|
|
657
|
+
a broadcast):
|
|
656
658
|
|
|
657
659
|
```text
|
|
658
|
-
producer -> redact -> sample -> buffer ->
|
|
660
|
+
producer -> classify -> redact -> sample -> buffer -> webhook -> local spool (~/.pi-harness-runtime/logs/spool)
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
**Server side** (durable hand-off, then an independent upload):
|
|
664
|
+
|
|
665
|
+
```text
|
|
666
|
+
POST /api/logs -> authenticate -> validate -> durable outbox -> 202
|
|
667
|
+
|
|
|
668
|
+
v
|
|
669
|
+
worker -> R2 -> done
|
|
659
670
|
```
|
|
660
671
|
|
|
661
672
|
- The local spool is the fallback: if every transport fails the batch is written to
|
|
662
673
|
disk as NDJSON and re-shipped on the next successful flush. Nothing is lost, only delayed.
|
|
663
674
|
- The local log files (`~/.pi-harness-runtime/logs/*.jsonl`, `harness/*.log`) stay the
|
|
664
675
|
source of truth. The centralized pipeline is a copy for the archive.
|
|
676
|
+
- **Only the server writes to R2.** In `auto` mode the webhook is preferred when
|
|
677
|
+
`PI_LOG_WEBHOOK_URL` is set, so client machines need no R2 credentials.
|
|
678
|
+
|
|
679
|
+
**What may leave the machine** (`classify`): an event allowlist decides, not a
|
|
680
|
+
denylist. Structured service/session/validation events are remote; the catch-all
|
|
681
|
+
`harness.log` mirror of a local log line, prompts, responses and command output stay
|
|
682
|
+
local. A message only travels when it looks sanitized (one line, short, no path, no
|
|
683
|
+
URL with a query string), and fields with a private key name (`prompt`, `output`,
|
|
684
|
+
`path`, `url`, `user`, ...) are dropped. `PI_LOG_DIAGNOSTIC=1` relaxes the message rule
|
|
685
|
+
for a user who explicitly asked for more - it never widens the event allowlist.
|
|
665
686
|
|
|
666
687
|
**Configuration** (environment first, then `~/.pi-harness-runtime/keys/`):
|
|
667
688
|
|
|
@@ -676,6 +697,9 @@ producer -> redact -> sample -> buffer -> R2 -> webhook -> local spool (~/.pi-ha
|
|
|
676
697
|
| `PI_LOG_FLUSH_INTERVAL_MS` | Automatic flush interval | `15000` |
|
|
677
698
|
| `PI_LOG_WEBHOOK_URL` | Ingest URL of the webhook server | unset |
|
|
678
699
|
| `PI_LOG_WEBHOOK_TOKEN` | Bearer token for the ingest endpoint | unset |
|
|
700
|
+
| `PI_LOG_APP_VERSION` | Version reported with every batch | unset |
|
|
701
|
+
| `PI_LOG_INSTALLATION_ID` | Stable id of this installation | generated once |
|
|
702
|
+
| `PI_LOG_DIAGNOSTIC` | `1` allows raw messages (events stay allowlisted) | unset |
|
|
679
703
|
| `PI_LOG_R2_BUCKET` / `PI_LOG_R2_ENDPOINT` / `PI_LOG_R2_ACCESS_KEY_ID` / `PI_LOG_R2_SECRET_ACCESS_KEY` | R2 credentials | key files |
|
|
680
704
|
| `PI_LOG_SPOOL_DIR` | Local spool directory | `~/.pi-harness-runtime/logs/spool` |
|
|
681
705
|
|
|
@@ -686,9 +710,32 @@ R2 credentials are read from the key files `r2-bucket-name.txt`, `r2-endpoint.tx
|
|
|
686
710
|
|
|
687
711
|
- Emit through the singleton: `centralInfo/centralWarn/centralError(source, event, message?, fields?)`.
|
|
688
712
|
The `source` identifies the component, the `event` is a dotted name.
|
|
713
|
+
- The event name decides whether a record may leave the machine. Use one of the
|
|
714
|
+
allowlisted shapes (`service.*`, `session.*`, `validation.*`, `harness.service-diagnostics.*`,
|
|
715
|
+
`harness.planner.decision`, `harness.glm-quota.quota`, ...) or a `warn`/`error` level.
|
|
716
|
+
An unknown event stays local.
|
|
689
717
|
- Redaction is automatic (key names, credential patterns, truncation), but producers must
|
|
690
718
|
not pass user content: prompts, raw model output and message bodies are dropped by the
|
|
691
719
|
redactor, so shipping them is pointless.
|
|
692
720
|
- Never put a credential in a log message. The redactor is a safety net, not a licence.
|
|
693
|
-
-
|
|
694
|
-
|
|
721
|
+
- Prefer a structured event over mirroring a local log line. The `logToFile()` mirror
|
|
722
|
+
(`harness.log`) stays local on purpose - the local file is the source of truth.
|
|
723
|
+
|
|
724
|
+
**Server endpoints** (all require an ingest credential):
|
|
725
|
+
|
|
726
|
+
| Route | Method | Purpose |
|
|
727
|
+
|-------|--------|---------|
|
|
728
|
+
| `/api/logs` | POST | Accept a batch. `202` only after the durable write, `503` when the endpoint is not configured or the queue is unavailable (the client keeps its spool). |
|
|
729
|
+
| `/api/logs/query` | POST | Read-only, tenant-scoped metadata query (installation, session, time range, level, source, event). Bounded and paginated; never returns message text. |
|
|
730
|
+
| `/api/logs/health` | GET | Queue depth, oldest pending age, failure count, last error. |
|
|
731
|
+
|
|
732
|
+
**Ingest credentials** (server side):
|
|
733
|
+
|
|
734
|
+
- The endpoint **fails closed**: without a credential every write is refused with `503`.
|
|
735
|
+
- `LOG_INGEST_TOKEN` (or `keys/log-ingest-token.txt`) is a shared token for a
|
|
736
|
+
single-tenant deployment; `LOG_INGEST_TENANT` names its tenant.
|
|
737
|
+
- `keys/log-ingest-credentials.json` holds scoped credentials, one per installation:
|
|
738
|
+
`{ "id", "tenantId", "label", "scopes", "tokenHash", "createdAt", "revokedAt" }`.
|
|
739
|
+
Tokens are stored as SHA-256 hashes; the tenant is derived from the credential and
|
|
740
|
+
never from the request body.
|
|
741
|
+
- Rotate by adding an entry and revoking the old one (`revokedAt`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/capability-registry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.397",
|
|
4
4
|
"description": "Capability Registry for pi-harness-runtime — tracks model capabilities and enables capability-based routing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -3,17 +3,26 @@
|
|
|
3
3
|
Centralized structured application logging for pi-harness.
|
|
4
4
|
|
|
5
5
|
```text
|
|
6
|
-
producer -> redact -> sample -> buffer ->
|
|
6
|
+
client: producer -> classify -> redact -> sample -> buffer -> webhook -> local spool
|
|
7
|
+
server: POST /api/logs -> authenticate -> validate -> durable outbox -> 202
|
|
8
|
+
|
|
|
9
|
+
v
|
|
10
|
+
worker -> R2 -> done
|
|
7
11
|
```
|
|
8
12
|
|
|
13
|
+
- **Classification**: an event allowlist decides what may leave the machine. Prompts,
|
|
14
|
+
responses, command output and the catch-all `harness.log` mirror stay local.
|
|
9
15
|
- **Redaction**: credential-looking keys, bearer tokens, JWTs and long token runs are
|
|
10
16
|
replaced; strings are truncated and structures are depth limited.
|
|
11
17
|
- **Sampling**: minimum level, a deterministic sample rate for `debug` records and a
|
|
12
18
|
per source+event rate limit. Errors are never sampled away.
|
|
13
19
|
- **Buffering**: bounded in-memory buffer; when it is full the least severe record is
|
|
14
20
|
dropped and the drop is counted.
|
|
15
|
-
- **Delivery**: transports are
|
|
16
|
-
|
|
21
|
+
- **Delivery**: transports are a FALLBACK chain (the first success wins, the rest are
|
|
22
|
+
skipped - never a broadcast). If all of them fail the batch is spooled to disk as
|
|
23
|
+
NDJSON and retried on the next flush.
|
|
24
|
+
- **Durability**: the server only answers `202` after the batch is written to its
|
|
25
|
+
durable outbox. A background worker uploads it to R2 with a bounded backoff.
|
|
17
26
|
|
|
18
27
|
## Usage
|
|
19
28
|
|
|
@@ -21,17 +30,43 @@ producer -> redact -> sample -> buffer -> R2 -> webhook -> local spool
|
|
|
21
30
|
import { centralInfo, centralWarn, initCentralLogging } from "./packages/logging/dist/index.js";
|
|
22
31
|
|
|
23
32
|
initCentralLogging(); // reads the environment and the key files
|
|
24
|
-
centralInfo("harness", "
|
|
33
|
+
centralInfo("harness.service-diagnostics", "service.check", "service is up", { durationMs: 3 });
|
|
25
34
|
```
|
|
26
35
|
|
|
36
|
+
The event name decides whether the record may be shipped: use an allowlisted shape
|
|
37
|
+
(`service.*`, `session.*`, `validation.*`, `harness.service-diagnostics.*`,
|
|
38
|
+
`harness.planner.decision`, `harness.glm-quota.quota`) or a `warn`/`error` level.
|
|
39
|
+
|
|
27
40
|
## Transports
|
|
28
41
|
|
|
29
42
|
| Transport | Purpose |
|
|
30
43
|
|-----------|---------|
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
44
|
+
| `createWebhookTransport` | HTTP POST to the unified webhook server (`/api/logs`) - the client ingress point |
|
|
45
|
+
| `createR2Transport` | Cloudflare R2 (S3 API), gzipped NDJSON under a date prefix - normally used by the server, not by clients |
|
|
33
46
|
| `LogSpool` | Local NDJSON fallback, rotated by size, with retention |
|
|
34
47
|
|
|
48
|
+
## Server side
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import {
|
|
52
|
+
LogCredentialStore,
|
|
53
|
+
LogIndexStore,
|
|
54
|
+
LogIngestService,
|
|
55
|
+
LogOutbox,
|
|
56
|
+
LogOutboxWorker,
|
|
57
|
+
createLogHttpHandler,
|
|
58
|
+
} from "./packages/logging/dist/index.js";
|
|
59
|
+
|
|
60
|
+
const credentials = LogCredentialStore.load();
|
|
61
|
+
const outbox = new LogOutbox({ dir: `${home}/.pi-harness-runtime/logs/outbox` });
|
|
62
|
+
const index = new LogIndexStore({ dir: `${home}/.pi-harness-runtime/logs/index` });
|
|
63
|
+
const service = new LogIngestService({ credentials, outbox, index });
|
|
64
|
+
const handler = createLogHttpHandler({ service, outbox, index });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The credential store decides whether the endpoint exists: without a credential every
|
|
68
|
+
write is refused (`503`). The tenant comes from the credential, never from the body.
|
|
69
|
+
|
|
35
70
|
## Configuration
|
|
36
71
|
|
|
37
72
|
See the "Centralized Application Logging" section in the repository `AGENTS.md`.
|