@cotal-ai/pi 0.11.3 → 0.11.4
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/README.md +5 -2
- package/dist/driver.d.ts.map +1 -1
- package/dist/inbox-turn.d.ts +14 -24
- package/dist/inbox-turn.d.ts.map +1 -1
- package/dist/inbox-types.d.ts +39 -0
- package/dist/inbox-types.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21591 -5
- package/dist/standalone.js +413 -159
- package/dist/tools.d.ts.map +1 -1
- package/package.json +8 -9
- package/dist/connector.js +0 -98
- package/dist/connector.js.map +0 -1
- package/dist/driver.js +0 -347
- package/dist/driver.js.map +0 -1
- package/dist/extension.js +0 -135
- package/dist/extension.js.map +0 -1
- package/dist/inbox-turn.js +0 -108
- package/dist/inbox-turn.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/standalone.js.map +0 -1
- package/dist/tools.js +0 -113
- package/dist/tools.js.map +0 -1
package/README.md
CHANGED
|
@@ -38,8 +38,8 @@ Inbound traffic is injected as a `cotal-inbox` custom message. Its opaque batch
|
|
|
38
38
|
in Pi's `message_start` and in the exact provider `context`. A successful `after_provider_response`
|
|
39
39
|
confirms the batch early when the transport exposes an HTTP response; transports such as the Codex
|
|
40
40
|
subscription may omit that hook, so an exact context is confirmed instead by its following clean
|
|
41
|
-
terminal boundary. Acknowledgement waits for that boundary and drains only
|
|
42
|
-
|
|
41
|
+
terminal boundary. Acknowledgement waits for that boundary and drains only the confirmed IDs,
|
|
42
|
+
even when pull-only quiet traffic is interleaved ahead of them.
|
|
43
43
|
|
|
44
44
|
- Crash or quit before a terminal boundary: acknowledge nothing; durable traffic redelivers.
|
|
45
45
|
- Non-aborted `stop`, `toolUse`, and non-overflow `length` (positive output) are terminal and may
|
|
@@ -55,6 +55,9 @@ is attributed context rather than a human prompt. Provider hooks, tool hooks, an
|
|
|
55
55
|
permission/sandbox extensions still run. Replies remain deliberate model actions through
|
|
56
56
|
`cotal_dm`, `cotal_send`, or `cotal_anycast`; chat output alone is not sent to peers.
|
|
57
57
|
|
|
58
|
+
Quiet-channel ambient is never included in automatic or continuation batches. It remains buffered
|
|
59
|
+
until `cotal_inbox` explicitly surfaces and clears it; quiet `@mention`s remain automatic.
|
|
60
|
+
|
|
58
61
|
Pi resume, model variants, MCP sharing, and raw launch options are not implemented and fail loudly.
|
|
59
62
|
Persona files and `--model` are supported; an explicit spawn model wins over the persona file.
|
|
60
63
|
|
package/dist/driver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAQrE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,MAAM,GAAG,cAAc,CAAC;AAEzF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,IAAI,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,EAAE,EAAE;QAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IAC5E,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,MAAM;IACrB,WAAW,CACT,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,iBAAiB,CAAA;KAAE,EAC9F,OAAO,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AOjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAMrB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC,OAAO,CAAC,IAAI;IAiDZ,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,IAAI;IASZ,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,WAAW;CAGpB"}
|
package/dist/inbox-turn.d.ts
CHANGED
|
@@ -1,41 +1,31 @@
|
|
|
1
|
-
import type { InboxItem } from "
|
|
1
|
+
import type { ExactDrainResult, InboxItem, InboxScope } from "./inbox-types.js";
|
|
2
2
|
export interface InboxSource {
|
|
3
|
-
peekInbox(): InboxItem[];
|
|
3
|
+
peekInbox(scope?: InboxScope): InboxItem[];
|
|
4
4
|
drainInbox(limit?: number): InboxItem[];
|
|
5
|
+
drainInboxIds(ids: readonly string[]): ExactDrainResult;
|
|
5
6
|
}
|
|
6
7
|
export interface CommitResult {
|
|
7
8
|
drained: number;
|
|
8
9
|
tombstoned: number;
|
|
9
|
-
error?: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Pi-local acknowledgement ledger over MeshAgent's
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* prefix. Missing ids are allowed only at the older edge, where MeshAgent's bounded inbox may have
|
|
16
|
-
* force-evicted them. Anything else is tombstoned and left unacked rather than risking a positional
|
|
17
|
-
* drain of unrelated traffic. A late duplicate is discarded only when it reaches the front.
|
|
12
|
+
* Pi-local acknowledgement ledger over MeshAgent's exact-id drain API. Provider-confirmed items
|
|
13
|
+
* can be committed around interleaved pull-only traffic without positional acknowledgement;
|
|
14
|
+
* overflow-missing ids are tombstoned for exact late-duplicate discard.
|
|
18
15
|
*/
|
|
19
16
|
export declare class InboxTurn {
|
|
20
17
|
private readonly source;
|
|
21
18
|
private tombstones;
|
|
22
19
|
private previousTombstones;
|
|
23
20
|
constructor(source: InboxSource);
|
|
24
|
-
peek(): InboxItem[];
|
|
25
|
-
/** Remove already-confirmed late duplicates
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
select(reserved: ReadonlySet<string>, boundary: (item: InboxItem) => boolean, limit: number): InboxItem[];
|
|
34
|
-
/**
|
|
35
|
-
* Commit provider-confirmed ids without ever calling drainInbox(0), which means "drain all" in
|
|
36
|
-
* MeshAgent. On an invariant mismatch, acknowledge nothing and retain tombstones for exact later
|
|
37
|
-
* discard.
|
|
38
|
-
*/
|
|
21
|
+
peek(scope?: InboxScope): InboxItem[];
|
|
22
|
+
/** Remove already-confirmed late duplicates by exact id, even behind pull-only traffic. */
|
|
23
|
+
discardTombstoned(): number;
|
|
24
|
+
/** Exact discard for adapter-local traffic such as own echoes, even behind pull-only items. */
|
|
25
|
+
discardMatching(match: (item: InboxItem) => boolean): number;
|
|
26
|
+
/** Select the next automatic FIFO batch after already-reserved ids. */
|
|
27
|
+
select(reserved: ReadonlySet<string>, limit: number): InboxItem[];
|
|
28
|
+
/** Commit provider-confirmed ids exactly; tombstone any already absent after overflow. */
|
|
39
29
|
commitConfirmed(ids: readonly string[]): CommitResult;
|
|
40
30
|
private hasTombstone;
|
|
41
31
|
private addTombstone;
|
package/dist/inbox-turn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-turn.d.ts","sourceRoot":"","sources":["../src/inbox-turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inbox-turn.d.ts","sourceRoot":"","sources":["../src/inbox-turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhF,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,EAAE,CAAC;IAC3C,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;IACxC,aAAa,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAAC;CACzD;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;;;GAIG;AACH,qBAAa,SAAS;IAIR,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,kBAAkB,CAAqB;gBAElB,MAAM,EAAE,WAAW;IAEhD,IAAI,CAAC,KAAK,GAAE,UAAkB,GAAG,SAAS,EAAE;IAI5C,2FAA2F;IAC3F,iBAAiB,IAAI,MAAM;IAM3B,+FAA+F;IAC/F,eAAe,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,GAAG,MAAM;IAM5D,uEAAuE;IACvE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE;IAUjE,0FAA0F;IAC1F,eAAe,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY;IASrD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi's PUBLIC inbox type surface (the SDK-embedder exports on the `.` entry). These describe the
|
|
3
|
+
* shape of what `MeshAgent`'s inbox API returns — which pi bundles at runtime — but pi must not leak
|
|
4
|
+
* `@cotal-ai/connector-core` (a build-only dep, absent from an installed plugin) into its shipped
|
|
5
|
+
* `.d.ts`, so it OWNS the public contract here instead of re-exporting connector-core's types.
|
|
6
|
+
*
|
|
7
|
+
* The drift guard at the bottom proves these stay structurally identical to connector-core's, at
|
|
8
|
+
* pi's build (where connector-core IS resolvable, as a devDep); a skew is a loud typecheck error,
|
|
9
|
+
* never a silent one. It is referenced by no exported symbol, so it is elided from the shipped
|
|
10
|
+
* declarations and erased from the bundle.
|
|
11
|
+
*/
|
|
12
|
+
export type InboxScope = "all" | "automatic" | "pull-only";
|
|
13
|
+
export interface InboxItem {
|
|
14
|
+
id: string;
|
|
15
|
+
ts: number;
|
|
16
|
+
fromId: string;
|
|
17
|
+
fromName: string;
|
|
18
|
+
fromRole?: string;
|
|
19
|
+
kind: "channel" | "dm" | "anycast";
|
|
20
|
+
/** Set when kind === "channel". */
|
|
21
|
+
channel?: string;
|
|
22
|
+
/** Set when kind === "anycast" (the role addressed). */
|
|
23
|
+
service?: string;
|
|
24
|
+
/** Lowercased names called out on a channel message (priority hint). */
|
|
25
|
+
mentions?: string[];
|
|
26
|
+
/** True iff this message mentions us by name. */
|
|
27
|
+
mentionsMe: boolean;
|
|
28
|
+
/** True iff this is backfilled history (a "catching up" block on join), not a live message. */
|
|
29
|
+
historical: boolean;
|
|
30
|
+
text: string;
|
|
31
|
+
replyTo?: string;
|
|
32
|
+
contextId?: string;
|
|
33
|
+
}
|
|
34
|
+
/** An exact-id drain: the items found plus the ids that were not present. */
|
|
35
|
+
export interface ExactDrainResult {
|
|
36
|
+
items: InboxItem[];
|
|
37
|
+
missingIds: string[];
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=inbox-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-types.d.ts","sourceRoot":"","sources":["../src/inbox-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iDAAiD;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,+FAA+F;IAC/F,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import "./connector.js";
|
|
|
2
2
|
export { piConnector } from "./connector.js";
|
|
3
3
|
export { default as cotalMeshExtension } from "./extension.js";
|
|
4
4
|
export { InboxTurn, type InboxSource } from "./inbox-turn.js";
|
|
5
|
+
export type { InboxItem, InboxScope, ExactDrainResult } from "./inbox-types.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|