@idleware/ringi 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +83 -2
- package/package.json +51 -4
- package/src/main/resources/profiles/a2a-1.json +43 -0
- package/src/main/resources/skill/ringi/SKILL.md +72 -0
- package/target/dts/app/agent.d.ts +104 -0
- package/target/dts/app/budget.d.ts +36 -0
- package/target/dts/app/context.d.ts +19 -0
- package/target/dts/app/hubs.d.ts +38 -0
- package/target/dts/app/overview.d.ts +25 -0
- package/target/dts/app/room.d.ts +76 -0
- package/target/dts/app/rooms.d.ts +26 -0
- package/target/dts/app/session.d.ts +60 -0
- package/target/dts/app/view.d.ts +64 -0
- package/target/dts/cli/agent.d.ts +10 -0
- package/target/dts/cli/args.d.ts +13 -0
- package/target/dts/cli/context.d.ts +6 -0
- package/target/dts/cli/index.d.ts +5 -0
- package/target/dts/cli/operator.d.ts +8 -0
- package/target/dts/cli/session.d.ts +7 -0
- package/target/dts/cli/shared.d.ts +20 -0
- package/target/dts/cli/skill.d.ts +4 -0
- package/target/dts/cli.d.ts +3 -0
- package/target/dts/domain/decisions.d.ts +65 -0
- package/target/dts/domain/index.d.ts +2 -0
- package/target/dts/domain/profiles.d.ts +39 -0
- package/target/dts/domain/signals.d.ts +37 -0
- package/target/dts/home/index.d.ts +21 -0
- package/target/dts/hub/index.d.ts +66 -0
- package/target/dts/hub/signals.d.ts +4 -0
- package/target/dts/index.d.ts +8 -0
- package/target/dts/lib/index.d.ts +18 -0
- package/target/dts/protocol/files.d.ts +9 -0
- package/target/dts/protocol/index.d.ts +72 -0
- package/target/dts/runtime/reader.d.ts +34 -0
- package/target/dts/runtime/session.d.ts +42 -0
- package/target/dts/runtime/watch.d.ts +17 -0
- package/target/dts/store/git/index.d.ts +64 -0
- package/target/dts/store/git/remote.d.ts +70 -0
- package/target/dts/store/index.d.ts +102 -0
- package/target/dts/store/kafka/index.d.ts +2 -0
- package/target/dts/store/temporal/index.d.ts +2 -0
- package/target/esm/app/agent.js +83 -0
- package/target/esm/app/budget.js +94 -0
- package/target/esm/app/context.js +15 -0
- package/target/esm/app/hubs.js +75 -0
- package/target/esm/app/overview.js +38 -0
- package/target/esm/app/room.js +126 -0
- package/target/esm/app/rooms.js +119 -0
- package/target/esm/app/session.js +96 -0
- package/target/esm/app/view.js +51 -0
- package/target/esm/cli/agent.js +39 -0
- package/target/esm/cli/args.js +60 -0
- package/target/esm/cli/context.js +7 -0
- package/target/esm/cli/index.js +124 -0
- package/target/esm/cli/operator.js +146 -0
- package/target/esm/cli/session.js +38 -0
- package/target/esm/cli/shared.js +142 -0
- package/target/esm/cli/skill.js +53 -0
- package/target/esm/cli.js +13 -0
- package/target/esm/domain/decisions.js +177 -0
- package/target/esm/domain/index.js +15 -0
- package/target/esm/domain/profiles.js +95 -0
- package/target/esm/domain/signals.js +128 -0
- package/target/esm/home/index.js +87 -0
- package/target/esm/hub/index.js +211 -0
- package/target/esm/hub/signals.js +26 -0
- package/target/esm/index.js +8 -0
- package/target/esm/lib/index.js +201 -0
- package/target/esm/protocol/files.js +18 -0
- package/target/esm/protocol/index.js +216 -0
- package/target/esm/runtime/reader.js +63 -0
- package/target/esm/runtime/session.js +111 -0
- package/target/esm/runtime/watch.js +303 -0
- package/target/esm/store/git/index.js +345 -0
- package/target/esm/store/git/remote.js +699 -0
- package/target/esm/store/index.js +14 -0
- package/target/esm/store/kafka/index.js +2 -0
- package/target/esm/store/temporal/index.js +2 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Budget, Proposal, Usage } from '../domain/decisions.ts';
|
|
2
|
+
import type { Task } from '../domain/profiles.ts';
|
|
3
|
+
import type { All, FileRef, Message } from '../protocol/index.ts';
|
|
4
|
+
export declare const render: (all: All, m: Message, { max, files }?: {
|
|
5
|
+
max?: number;
|
|
6
|
+
files?: () => FileRef[];
|
|
7
|
+
}) => string;
|
|
8
|
+
export declare const oneLine: (m: Message) => string;
|
|
9
|
+
export declare const asJson: (m: Message) => {
|
|
10
|
+
id: string;
|
|
11
|
+
from: string;
|
|
12
|
+
trust: "asserted" | "verified";
|
|
13
|
+
to: string[];
|
|
14
|
+
re: string | null;
|
|
15
|
+
kind: string | null;
|
|
16
|
+
state: string | null;
|
|
17
|
+
assign: string[] | null;
|
|
18
|
+
roles: Record<string, string> | null;
|
|
19
|
+
hop: number;
|
|
20
|
+
hopEff: number;
|
|
21
|
+
bad: string | null;
|
|
22
|
+
time: string;
|
|
23
|
+
subject: string;
|
|
24
|
+
body: string;
|
|
25
|
+
files: {
|
|
26
|
+
path: string;
|
|
27
|
+
size: number | null;
|
|
28
|
+
}[];
|
|
29
|
+
refused: import("../protocol/index.ts").Refused[];
|
|
30
|
+
trailers: import("../protocol/index.ts").Trailers;
|
|
31
|
+
};
|
|
32
|
+
export type TaskView = {
|
|
33
|
+
id: string;
|
|
34
|
+
subject: string;
|
|
35
|
+
requester: string;
|
|
36
|
+
assignees: string[];
|
|
37
|
+
roles: Record<string, string>;
|
|
38
|
+
taken: string[];
|
|
39
|
+
grant: string | null;
|
|
40
|
+
state: string;
|
|
41
|
+
by: string;
|
|
42
|
+
at: string;
|
|
43
|
+
};
|
|
44
|
+
export declare const taskView: (t: Task, taken: string[]) => TaskView;
|
|
45
|
+
export type ProposalView = {
|
|
46
|
+
id: string;
|
|
47
|
+
subject: string;
|
|
48
|
+
from: string;
|
|
49
|
+
decider: string;
|
|
50
|
+
state: string;
|
|
51
|
+
budget: Budget | null;
|
|
52
|
+
stamps: Proposal['stamps'];
|
|
53
|
+
missing: string[];
|
|
54
|
+
};
|
|
55
|
+
export declare const proposalView: (x: Proposal) => ProposalView;
|
|
56
|
+
export type GrantView = {
|
|
57
|
+
grant: string;
|
|
58
|
+
proposal: string;
|
|
59
|
+
subject: string;
|
|
60
|
+
budget: Budget;
|
|
61
|
+
revoked: boolean;
|
|
62
|
+
usage: Usage;
|
|
63
|
+
};
|
|
64
|
+
export declare const grantView: (x: Proposal, usage: Usage) => GrantView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as Agent from '../app/agent.ts';
|
|
2
|
+
import type { Opts } from './args.ts';
|
|
3
|
+
import type { Ctx } from './context.ts';
|
|
4
|
+
export declare const showInbox: ({ R, me, s }: Ctx, res: Agent.Inbox, o: Opts) => void;
|
|
5
|
+
export declare const inbox: (a: Ctx, o: Opts) => void;
|
|
6
|
+
export declare const take: (a: Ctx, o: Opts) => void;
|
|
7
|
+
export declare const whoami: (a: Ctx) => void;
|
|
8
|
+
export declare const card: (a: Ctx, o: Opts) => void;
|
|
9
|
+
export declare const ping: (a: Ctx, o: Opts) => void;
|
|
10
|
+
export declare const wait: (a: Ctx, o: Opts) => Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Entry } from '../protocol/files.ts';
|
|
2
|
+
export declare const out: (s?: string) => void;
|
|
3
|
+
export declare const dump: (v: unknown) => void;
|
|
4
|
+
export type Opts = {
|
|
5
|
+
_: string[];
|
|
6
|
+
[key: string]: string | string[] | boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare const parseArgs: (argv: string[]) => Opts;
|
|
9
|
+
export declare const opt: (o: Opts, key: string) => string | undefined;
|
|
10
|
+
export declare const list: (o: Opts, key: string) => string[];
|
|
11
|
+
export declare const flag: (o: Opts, key: string) => boolean;
|
|
12
|
+
export declare const textOf: (o: Opts) => string;
|
|
13
|
+
export declare const attachments: (spec: string) => Entry[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Context from '../app/context.ts';
|
|
2
|
+
import type { Opts } from './args.ts';
|
|
3
|
+
export type { Ctx } from '../app/context.ts';
|
|
4
|
+
export { isRef } from '../app/room.ts';
|
|
5
|
+
export declare const parseTo: (v: unknown) => string[];
|
|
6
|
+
export declare const operatorCtx: (o: Opts) => Context.Ctx;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Profile } from '../domain/profiles.ts';
|
|
2
|
+
export declare const TABLE: Array<[string, 'operator' | 'session' | 'agent' | 'both', string]>;
|
|
3
|
+
export declare const helpMarkdown: () => string;
|
|
4
|
+
export declare const main: (argv?: string[]) => Promise<void>;
|
|
5
|
+
export type { Profile };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SessionView } from '../app/overview.ts';
|
|
2
|
+
import type { Opts } from './args.ts';
|
|
3
|
+
export declare const sessionLine: (s: SessionView) => string;
|
|
4
|
+
export declare const where: (o: Opts) => Promise<void>;
|
|
5
|
+
export declare const sessions: (o: Opts) => void;
|
|
6
|
+
export declare const forget: (o: Opts) => void;
|
|
7
|
+
export declare const hub: (o: Opts) => void;
|
|
8
|
+
export declare const roomCmd: (o: Opts) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Session from '../app/session.ts';
|
|
2
|
+
import type { Opts } from './args.ts';
|
|
3
|
+
export declare const briefing: (s: Session.Session) => void;
|
|
4
|
+
export declare const join: (o: Opts) => void;
|
|
5
|
+
export declare const resume: (o: Opts) => void;
|
|
6
|
+
export declare const stop: () => void;
|
|
7
|
+
export declare const leave: () => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TaskView } from '../app/view.ts';
|
|
2
|
+
import type { Opts } from './args.ts';
|
|
3
|
+
import type { Ctx } from './context.ts';
|
|
4
|
+
export declare const send: (a: Ctx, o: Opts) => void;
|
|
5
|
+
export declare const reply: (a: Ctx, o: Opts) => void;
|
|
6
|
+
export declare const read: (a: Ctx, o: Opts) => void;
|
|
7
|
+
export declare const thread: (a: Ctx, o: Opts) => void;
|
|
8
|
+
export declare const taskLine: (t: TaskView) => string;
|
|
9
|
+
export declare const tasks: (a: Ctx, o: Opts) => void;
|
|
10
|
+
export declare const log: (a: Ctx, o: Opts) => void;
|
|
11
|
+
export declare const cat: (a: Ctx, o: Opts) => void;
|
|
12
|
+
export declare const get: (a: Ctx, o: Opts) => void;
|
|
13
|
+
export declare const who: (a: Ctx) => void;
|
|
14
|
+
export declare const signals: (a: Ctx, o: Opts) => void;
|
|
15
|
+
export declare const profileCmd: ({ R }: Ctx, o: Opts) => void;
|
|
16
|
+
export declare const propose: (a: Ctx, o: Opts) => void;
|
|
17
|
+
export declare const stamp_: (a: Ctx, o: Opts) => void;
|
|
18
|
+
export declare const decide: (a: Ctx, o: Opts) => void;
|
|
19
|
+
export declare const proposals: (a: Ctx, o: Opts) => void;
|
|
20
|
+
export declare const grants: (a: Ctx, o: Opts) => void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { All, Message, Parsed } from '../protocol/index.ts';
|
|
2
|
+
export declare const CAPABILITY = "decisions/1";
|
|
3
|
+
export declare const ROOT = "operator";
|
|
4
|
+
export declare const BUDGET_KEYS: readonly ['runs', 'run-seconds', 'concurrency'];
|
|
5
|
+
export type Budget = {
|
|
6
|
+
runs: number;
|
|
7
|
+
'run-seconds': number;
|
|
8
|
+
concurrency: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const STAMPS: string[];
|
|
11
|
+
export declare const DECISIONS: string[];
|
|
12
|
+
export type Authority = {
|
|
13
|
+
decide?: Record<string, Partial<Budget>>;
|
|
14
|
+
};
|
|
15
|
+
export type AuthorityAt = (control: string | null) => Authority | null;
|
|
16
|
+
export declare const parseBudget: (s: string | null | undefined) => Budget | null | undefined;
|
|
17
|
+
export declare const budgetText: (b: Budget) => string;
|
|
18
|
+
export declare const parseDue: (s: string) => string;
|
|
19
|
+
export declare const check: (m: Parsed, isRef: (s: string) => boolean) => string | null;
|
|
20
|
+
export declare const mayDecide: (authority: Authority | null, decider: string, proposer: string, budget: Budget | null) => boolean;
|
|
21
|
+
export type Grant = {
|
|
22
|
+
id: string;
|
|
23
|
+
budget: Budget;
|
|
24
|
+
proposal: Message;
|
|
25
|
+
revoked: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type Proposal = {
|
|
28
|
+
proposal: Message;
|
|
29
|
+
decider: string;
|
|
30
|
+
reviewers: string[];
|
|
31
|
+
budget: Budget | null;
|
|
32
|
+
due: number | null;
|
|
33
|
+
stamps: Record<string, {
|
|
34
|
+
stamp: string;
|
|
35
|
+
id: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
}>;
|
|
38
|
+
missing: string[];
|
|
39
|
+
decision: {
|
|
40
|
+
decision: string;
|
|
41
|
+
id: string;
|
|
42
|
+
by: string;
|
|
43
|
+
time: number;
|
|
44
|
+
} | null;
|
|
45
|
+
revoked: {
|
|
46
|
+
id: string;
|
|
47
|
+
by: string;
|
|
48
|
+
time: number;
|
|
49
|
+
} | null;
|
|
50
|
+
superseded: Message | null;
|
|
51
|
+
state: string;
|
|
52
|
+
grant: Grant | null;
|
|
53
|
+
};
|
|
54
|
+
export declare const proposalOf: (all: All, p: Message, authorityAt: AuthorityAt, now?: number) => Proposal;
|
|
55
|
+
export declare const proposals: (all: All, authorityAt: AuthorityAt) => Proposal[];
|
|
56
|
+
export declare const grantOf: (all: All, authorityAt: AuthorityAt, id: string) => Grant | null;
|
|
57
|
+
export type Usage = {
|
|
58
|
+
runs: number;
|
|
59
|
+
open: number;
|
|
60
|
+
uncertain: number;
|
|
61
|
+
seconds: number;
|
|
62
|
+
left: number;
|
|
63
|
+
};
|
|
64
|
+
export declare const counted: (all: All, authorityAt: AuthorityAt, m: Message) => boolean;
|
|
65
|
+
export declare const usageOf: (all: All, grant: Grant, now?: number) => Usage;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { All, Message } from '../protocol/index.ts';
|
|
2
|
+
export declare const PROFILE_SCHEMA = "ringi-profile/1";
|
|
3
|
+
export declare const DEFAULT_PROFILE = "a2a-1";
|
|
4
|
+
export declare const PROFILES_CAPABILITY = "profiles/1";
|
|
5
|
+
export type Rules = {
|
|
6
|
+
assign?: string[];
|
|
7
|
+
roles?: string[];
|
|
8
|
+
grant?: string[];
|
|
9
|
+
[state: `state:${string}`]: string[] | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type Profile = {
|
|
12
|
+
schema: typeof PROFILE_SCHEMA;
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
opens: string;
|
|
16
|
+
states: string[];
|
|
17
|
+
initial: string;
|
|
18
|
+
terminal: string[];
|
|
19
|
+
waiting?: string;
|
|
20
|
+
rules: Rules;
|
|
21
|
+
};
|
|
22
|
+
export type Task = {
|
|
23
|
+
root: Message;
|
|
24
|
+
msgs: Message[];
|
|
25
|
+
state: string;
|
|
26
|
+
by: string;
|
|
27
|
+
at: number;
|
|
28
|
+
requester: string;
|
|
29
|
+
assignees: string[];
|
|
30
|
+
roles: Record<string, string>;
|
|
31
|
+
grant: string | null;
|
|
32
|
+
effects: Map<string, string[]>;
|
|
33
|
+
};
|
|
34
|
+
export declare const parseProfile: (text: string, label: string) => Profile;
|
|
35
|
+
export declare const ruleFor: (profile: Profile, state: string) => string[] | undefined;
|
|
36
|
+
export declare const taskFor: (all: All, m: Message, profile: Profile) => Message | null;
|
|
37
|
+
export declare const taskOf: (all: All, root: Message, profile: Profile) => Task;
|
|
38
|
+
export declare const tasksIn: (all: All, profile: Profile) => Task[];
|
|
39
|
+
export declare const isOpen: (t: Task, profile: Profile) => boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as D from './decisions.ts';
|
|
2
|
+
import type { Profile } from './profiles.ts';
|
|
3
|
+
import type { All, Message } from '../protocol/index.ts';
|
|
4
|
+
export type RoomModel = {
|
|
5
|
+
name: string;
|
|
6
|
+
genesis: string;
|
|
7
|
+
profile: Profile;
|
|
8
|
+
members: Record<string, unknown>;
|
|
9
|
+
authorityAt: D.AuthorityAt;
|
|
10
|
+
};
|
|
11
|
+
export type SignalRecord = {
|
|
12
|
+
ref: string;
|
|
13
|
+
object: string;
|
|
14
|
+
name: string;
|
|
15
|
+
actor: string;
|
|
16
|
+
target: string;
|
|
17
|
+
tagger: string;
|
|
18
|
+
text: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const MARKS: string[];
|
|
21
|
+
export declare const signalBody: (R: Pick<RoomModel, 'name' | 'genesis'>, who: string, id: string, signal: string) => string;
|
|
22
|
+
export declare const markWhy: (R: RoomModel, actor: string, m: Message, mark: string) => string | undefined;
|
|
23
|
+
export declare const marksOn: (checked: Checked[]) => Map<string, Record<string, string[]>>;
|
|
24
|
+
export declare const effective: (R: RoomModel, all: All, m: Message) => string[];
|
|
25
|
+
export type Checked = {
|
|
26
|
+
ref: string;
|
|
27
|
+
actor: string;
|
|
28
|
+
signal: string;
|
|
29
|
+
target: string;
|
|
30
|
+
ok: boolean;
|
|
31
|
+
why?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const check: (R: RoomModel, all: All, records: SignalRecord[]) => Checked[];
|
|
34
|
+
export declare const pins: (records: SignalRecord[], checked: Checked[], accepted?: Record<string, string>) => {
|
|
35
|
+
accepted: Record<string, string>;
|
|
36
|
+
alarms: string[];
|
|
37
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const ROOT: string;
|
|
2
|
+
export declare const RESOURCES: string;
|
|
3
|
+
export declare const VERSION: string;
|
|
4
|
+
export declare const HOME: string;
|
|
5
|
+
export declare const HOME_VERSION = 3;
|
|
6
|
+
export declare const OPERATOR = "operator";
|
|
7
|
+
export declare const guard: <T>(fn: () => T) => T;
|
|
8
|
+
export declare const mkdir: (d: string) => void;
|
|
9
|
+
export declare const writeJson: (f: string, v: unknown) => void;
|
|
10
|
+
export declare const readJson: <T>(f: string, dflt: T) => T;
|
|
11
|
+
export declare const hubsDir: () => string;
|
|
12
|
+
export declare const hubHome: (name: string) => string;
|
|
13
|
+
export declare const ensureHome: () => void;
|
|
14
|
+
export declare const locked: <T>(name: string, fn: () => T) => T;
|
|
15
|
+
export type Config = {
|
|
16
|
+
hub: string;
|
|
17
|
+
room: string | null;
|
|
18
|
+
};
|
|
19
|
+
export declare const configFile: () => string;
|
|
20
|
+
export declare const config: () => Config;
|
|
21
|
+
export declare const setConfig: (patch: Partial<Config>) => void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as D from '../domain/decisions.ts';
|
|
2
|
+
import { OPERATOR } from '../home/index.ts';
|
|
3
|
+
import type { Profile } from '../domain/profiles.ts';
|
|
4
|
+
import { HIDDEN } from '../protocol/index.ts';
|
|
5
|
+
import type { All, FileRef, Message } from '../protocol/index.ts';
|
|
6
|
+
import type { Descriptor, Member, Rev, Store, StoredMessage, StoredRoom } from '../store/index.ts';
|
|
7
|
+
import type { Entry } from '../protocol/files.ts';
|
|
8
|
+
export declare const HUB_MAJOR = 1;
|
|
9
|
+
export declare const CAPS: Set<string>;
|
|
10
|
+
export declare const RESERVED_ROOMS: Set<string>;
|
|
11
|
+
export type Contract = {
|
|
12
|
+
schema: 'ringi-hub';
|
|
13
|
+
version: string;
|
|
14
|
+
protocol: number;
|
|
15
|
+
trust: 'asserted' | 'signed';
|
|
16
|
+
capabilities?: string[];
|
|
17
|
+
profile?: string;
|
|
18
|
+
root?: string;
|
|
19
|
+
authority: D.Authority;
|
|
20
|
+
};
|
|
21
|
+
export type Hub = {
|
|
22
|
+
name: string;
|
|
23
|
+
dir: string;
|
|
24
|
+
d: Descriptor;
|
|
25
|
+
store: Store;
|
|
26
|
+
main: Rev;
|
|
27
|
+
contract: Contract;
|
|
28
|
+
signed: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type Room = {
|
|
31
|
+
hub: Hub;
|
|
32
|
+
s: StoredRoom;
|
|
33
|
+
name: string;
|
|
34
|
+
archived: boolean;
|
|
35
|
+
head: Rev;
|
|
36
|
+
genesis: Rev;
|
|
37
|
+
contractRev: Rev;
|
|
38
|
+
contract: Contract;
|
|
39
|
+
authorityAt: D.AuthorityAt;
|
|
40
|
+
profile: Profile;
|
|
41
|
+
members: Record<string, Member>;
|
|
42
|
+
};
|
|
43
|
+
export declare const hubNames: () => string[];
|
|
44
|
+
export declare const createHub: (name: string, { signed, url }?: {
|
|
45
|
+
signed?: boolean;
|
|
46
|
+
url?: string;
|
|
47
|
+
}) => void;
|
|
48
|
+
export declare const readDescriptor: (name: string) => Descriptor;
|
|
49
|
+
export declare const contractAt: (store: Store, name: string, rev: Rev) => Contract;
|
|
50
|
+
export declare const openHub: (name: string, { refresh }?: {
|
|
51
|
+
refresh?: boolean;
|
|
52
|
+
}) => Hub;
|
|
53
|
+
export declare const roomNames: (H: Hub, archived?: boolean) => string[];
|
|
54
|
+
export declare const openRoom: (H: Hub, name: string | null | undefined, { quiet }?: {
|
|
55
|
+
quiet?: boolean;
|
|
56
|
+
}) => Room | null;
|
|
57
|
+
export declare const room: (H: Hub, name: string | null | undefined) => Room;
|
|
58
|
+
export declare const ROOM_MD: (name: string) => string;
|
|
59
|
+
export declare const profileText: (H: Hub, name: string) => string | null;
|
|
60
|
+
export declare const controlChange: (R: Room, who: string, subject: string, mutate: (m: Record<string, Member>) => void, extra?: Array<[string, string]>) => void;
|
|
61
|
+
export declare const toMessage: (R: Room, from: string, x: StoredMessage, seq: number) => Message;
|
|
62
|
+
export declare const asStored: (R: Room) => All;
|
|
63
|
+
export declare const append: (R: Room, who: string, text: string, entries?: Entry[]) => Rev;
|
|
64
|
+
export declare const withSizes: (R: Room, m: Message) => FileRef[];
|
|
65
|
+
export declare const pongText: (me: string, m: Message, what: string) => string;
|
|
66
|
+
export { OPERATOR, HIDDEN };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { All, Message } from '../protocol/index.ts';
|
|
2
|
+
import type { Room } from './index.ts';
|
|
3
|
+
export declare const mark: (R: Room, who: string, m: Message, name: string) => boolean;
|
|
4
|
+
export declare const emit: (R: Room, who: string, all: All, m: Message) => number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './protocol/index.ts';
|
|
2
|
+
export * from './domain/profiles.ts';
|
|
3
|
+
export * as decide from './domain/decisions.ts';
|
|
4
|
+
export * as signals from './domain/signals.ts';
|
|
5
|
+
export type { Store, StoreFactory, Descriptor, StoredRoom, StoredMessage, SignalRecord, Rev } from './store/index.ts';
|
|
6
|
+
export { STORES } from './store/index.ts';
|
|
7
|
+
export { openHub, openRoom, createHub, contractAt } from './hub/index.ts';
|
|
8
|
+
export type { Hub, Room, Contract } from './hub/index.ts';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class Fail extends Error {
|
|
2
|
+
}
|
|
3
|
+
export declare const fail: (msg: string) => never;
|
|
4
|
+
export declare const note: (s: string) => void;
|
|
5
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
6
|
+
export declare const when: (t: number) => string;
|
|
7
|
+
export declare const bytes: (n: number) => string;
|
|
8
|
+
export declare const short: (id: string) => string;
|
|
9
|
+
export declare const stamp: () => string;
|
|
10
|
+
export declare const words: (v: unknown) => string[];
|
|
11
|
+
export declare const errno: (e: unknown) => string | undefined;
|
|
12
|
+
export declare const writeJsonAtomic: (file: string, v: unknown) => void;
|
|
13
|
+
export declare const strictJson: <T = unknown>(text: string, label?: string) => T;
|
|
14
|
+
export declare const locked: <T>(file: string, fn: () => T, timeout?: number) => T;
|
|
15
|
+
export declare const SANDBOX: RegExp;
|
|
16
|
+
export declare const cannotWrite: (where: string, detail: string) => never;
|
|
17
|
+
export declare const guardWrite: <T>(where: string, fn: () => T) => T;
|
|
18
|
+
export declare const mkdirIn: (where: string, d: string) => void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const ID_RE: RegExp;
|
|
2
|
+
export declare const TOKEN_RE: RegExp;
|
|
3
|
+
export declare const HOP_RE: RegExp;
|
|
4
|
+
export declare const TRAILER_RE: RegExp;
|
|
5
|
+
export declare const TEXT_MAX: number;
|
|
6
|
+
export declare const KNOWN: Set<string>;
|
|
7
|
+
export declare const HEARTBEATS: Set<string>;
|
|
8
|
+
export declare const HIDDEN: Set<string>;
|
|
9
|
+
export type Trailers = Record<string, string[]>;
|
|
10
|
+
export type FileRef = {
|
|
11
|
+
path: string;
|
|
12
|
+
size: number | null;
|
|
13
|
+
};
|
|
14
|
+
export type Refused = {
|
|
15
|
+
path: string;
|
|
16
|
+
mode?: string;
|
|
17
|
+
why?: string;
|
|
18
|
+
};
|
|
19
|
+
export type Message = {
|
|
20
|
+
id: string;
|
|
21
|
+
from: string;
|
|
22
|
+
trust: 'asserted' | 'verified';
|
|
23
|
+
time: number;
|
|
24
|
+
seq: number;
|
|
25
|
+
invalid: string | null;
|
|
26
|
+
subject: string;
|
|
27
|
+
body: string;
|
|
28
|
+
to: string[];
|
|
29
|
+
re: string | null;
|
|
30
|
+
kind: string | null;
|
|
31
|
+
state: string | null;
|
|
32
|
+
assign: string[] | null;
|
|
33
|
+
roles: Record<string, string> | null;
|
|
34
|
+
hop: number;
|
|
35
|
+
bad: string | null;
|
|
36
|
+
trailers: Trailers;
|
|
37
|
+
files: FileRef[];
|
|
38
|
+
refused: Refused[];
|
|
39
|
+
reId: string | null;
|
|
40
|
+
hopEff: number;
|
|
41
|
+
};
|
|
42
|
+
export type Logs = Map<string, Message[]>;
|
|
43
|
+
export type All = Map<string, Message>;
|
|
44
|
+
export type Parsed = Pick<Message, 'subject' | 'body' | 'to' | 're' | 'kind' | 'state' | 'assign' | 'roles' | 'hop' | 'bad' | 'trailers'>;
|
|
45
|
+
export declare const one: (m: {
|
|
46
|
+
trailers: Trailers;
|
|
47
|
+
}, k: string) => string | null;
|
|
48
|
+
export declare const decodeText: (buf: Uint8Array) => {
|
|
49
|
+
text: string;
|
|
50
|
+
invalid?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
invalid: string;
|
|
53
|
+
text?: undefined;
|
|
54
|
+
};
|
|
55
|
+
export declare const parse: (raw: string, isRef: (s: string) => boolean) => Parsed;
|
|
56
|
+
export declare const compose: (text: string, trailers: Array<[string, string | null | undefined | false]>) => string;
|
|
57
|
+
export declare const checkOutgoing: (text: string, isRef: (s: string) => boolean) => Parsed;
|
|
58
|
+
export declare const link: (logs: Logs) => All;
|
|
59
|
+
export declare const ordered: (list: Message[]) => Message[];
|
|
60
|
+
export declare const chainHas: (all: All, m: Message, top: Message) => boolean;
|
|
61
|
+
export declare const rootOf: (all: All, m: Message) => Message;
|
|
62
|
+
export declare const under: (all: All, top: Message) => Message[];
|
|
63
|
+
export declare const lookup: (all: All, ref: string) => Message;
|
|
64
|
+
export declare const visible: (m: Message, id: string, hidden: Set<string>) => boolean;
|
|
65
|
+
export declare const wakes: (m: Message, id: string, hidden: Set<string>) => boolean;
|
|
66
|
+
export declare const unread: (logs: Logs, id: string, cursors: Record<string, string>, limit: number | undefined, hidden: Set<string>) => {
|
|
67
|
+
msgs: Message[];
|
|
68
|
+
rest: number;
|
|
69
|
+
cursors: {
|
|
70
|
+
[x: string]: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Room } from '../hub/index.ts';
|
|
2
|
+
import type { All, Logs } from '../protocol/index.ts';
|
|
3
|
+
import type { Rev } from '../store/index.ts';
|
|
4
|
+
export type ReaderState = {
|
|
5
|
+
control?: Rev;
|
|
6
|
+
heads?: Record<string, Rev>;
|
|
7
|
+
alarms?: string[];
|
|
8
|
+
seen?: Record<string, string>;
|
|
9
|
+
watched?: Record<string, string>;
|
|
10
|
+
pending?: string[];
|
|
11
|
+
inflight?: {
|
|
12
|
+
seen: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
heartbeatSeen?: Record<string, string>;
|
|
15
|
+
runs?: number[];
|
|
16
|
+
exhausted?: Record<string, boolean>;
|
|
17
|
+
signals?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
export declare const readerFile: (R: Room, reader: string) => string;
|
|
20
|
+
export declare const readerLock: <T>(R: Room, reader: string, fn: () => T) => T;
|
|
21
|
+
export declare const loadState: (R: Room, reader: string) => ReaderState;
|
|
22
|
+
export declare const saveState: (R: Room, reader: string, st: ReaderState) => void;
|
|
23
|
+
export declare const loadRoomUnlocked: (R: Room, reader: string) => {
|
|
24
|
+
logs: Logs;
|
|
25
|
+
st: ReaderState;
|
|
26
|
+
};
|
|
27
|
+
export declare const loadRoom: (R: Room, reader: string) => {
|
|
28
|
+
logs: Logs;
|
|
29
|
+
st: ReaderState;
|
|
30
|
+
};
|
|
31
|
+
export declare const linked: (R: Room, reader: string) => {
|
|
32
|
+
logs: Logs;
|
|
33
|
+
all: All;
|
|
34
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Hub, Room } from '../hub/index.ts';
|
|
2
|
+
export declare const LEASE: number;
|
|
3
|
+
export type Session = {
|
|
4
|
+
handle: string;
|
|
5
|
+
product: string | null;
|
|
6
|
+
hub: string;
|
|
7
|
+
room: string;
|
|
8
|
+
genesis: string;
|
|
9
|
+
agent: string;
|
|
10
|
+
scope: string | null;
|
|
11
|
+
state: 'active' | 'stopped';
|
|
12
|
+
since: string;
|
|
13
|
+
lastSeen: string;
|
|
14
|
+
pid: number | null;
|
|
15
|
+
takenFrom?: string;
|
|
16
|
+
};
|
|
17
|
+
export type Me = {
|
|
18
|
+
handle: string;
|
|
19
|
+
product: string | null;
|
|
20
|
+
pid: number | null;
|
|
21
|
+
};
|
|
22
|
+
export declare const whoAmI: () => Me;
|
|
23
|
+
export declare const allSessions: () => Session[];
|
|
24
|
+
export declare const readSession: (handle: string) => Session | null;
|
|
25
|
+
export declare const saveSession: (s: Session) => void;
|
|
26
|
+
export declare const dropSession: (handle: string) => void;
|
|
27
|
+
export declare const pidAlive: (pid: number) => boolean;
|
|
28
|
+
export declare const liveness: (s: Session) => 'active' | 'stopped' | 'gone';
|
|
29
|
+
export declare const seatHolder: (hub: string, genesis: string, agent: string, except: string) => Session | undefined;
|
|
30
|
+
export declare const ownSession: (handle: string) => Session | null;
|
|
31
|
+
export type Bound = {
|
|
32
|
+
s: Session;
|
|
33
|
+
H: Hub;
|
|
34
|
+
R: Room;
|
|
35
|
+
me: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const bound: () => Bound;
|
|
38
|
+
export declare const parseSelector: (sel: string | undefined) => {
|
|
39
|
+
hub: string | null;
|
|
40
|
+
room: string;
|
|
41
|
+
agent: string;
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Room } from '../hub/index.ts';
|
|
2
|
+
export type WatchOptions = {
|
|
3
|
+
seat: string;
|
|
4
|
+
exec: string;
|
|
5
|
+
hub?: string;
|
|
6
|
+
scope?: string;
|
|
7
|
+
handoff?: boolean;
|
|
8
|
+
once?: boolean;
|
|
9
|
+
requireGrant?: boolean;
|
|
10
|
+
interval?: number;
|
|
11
|
+
from?: string[];
|
|
12
|
+
maxHop?: number;
|
|
13
|
+
maxRuns?: number;
|
|
14
|
+
window?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const watch: (w: WatchOptions, log?: (line: string) => void) => Promise<number>;
|
|
17
|
+
export type { Room };
|