@suwujs/king-ai 0.2.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/README.md +96 -0
- package/dist/src/agent-config-validation.d.ts +9 -0
- package/dist/src/agent-config-validation.js +30 -0
- package/dist/src/api.d.ts +4 -0
- package/dist/src/api.js +48 -0
- package/dist/src/attachments.d.ts +45 -0
- package/dist/src/attachments.js +322 -0
- package/dist/src/cli.d.ts +20 -0
- package/dist/src/cli.js +1697 -0
- package/dist/src/config.d.ts +3 -0
- package/dist/src/config.js +20 -0
- package/dist/src/cron.d.ts +11 -0
- package/dist/src/cron.js +65 -0
- package/dist/src/daemon.d.ts +36 -0
- package/dist/src/daemon.js +373 -0
- package/dist/src/engine.d.ts +32 -0
- package/dist/src/engine.js +1014 -0
- package/dist/src/heartbeat.d.ts +18 -0
- package/dist/src/heartbeat.js +28 -0
- package/dist/src/host-api.d.ts +40 -0
- package/dist/src/host-api.js +59 -0
- package/dist/src/host-control.d.ts +48 -0
- package/dist/src/host-control.js +1279 -0
- package/dist/src/host-export.d.ts +50 -0
- package/dist/src/host-export.js +187 -0
- package/dist/src/host-feedback.d.ts +78 -0
- package/dist/src/host-feedback.js +178 -0
- package/dist/src/host-home.d.ts +13 -0
- package/dist/src/host-home.js +54 -0
- package/dist/src/host-ledger.d.ts +261 -0
- package/dist/src/host-ledger.js +554 -0
- package/dist/src/host-loop-events.d.ts +69 -0
- package/dist/src/host-loop-events.js +288 -0
- package/dist/src/host-permission.d.ts +36 -0
- package/dist/src/host-permission.js +180 -0
- package/dist/src/host-policy.d.ts +15 -0
- package/dist/src/host-policy.js +36 -0
- package/dist/src/host-run-executor.d.ts +13 -0
- package/dist/src/host-run-executor.js +221 -0
- package/dist/src/host-run-heartbeat.d.ts +40 -0
- package/dist/src/host-run-heartbeat.js +103 -0
- package/dist/src/host-run-layout.d.ts +17 -0
- package/dist/src/host-run-layout.js +387 -0
- package/dist/src/host-run-meta.d.ts +41 -0
- package/dist/src/host-run-meta.js +115 -0
- package/dist/src/host-run-spec.d.ts +149 -0
- package/dist/src/host-run-spec.js +465 -0
- package/dist/src/host-runs.d.ts +77 -0
- package/dist/src/host-runs.js +195 -0
- package/dist/src/host-sdk.d.ts +412 -0
- package/dist/src/host-sdk.js +628 -0
- package/dist/src/host-server.d.ts +26 -0
- package/dist/src/host-server.js +921 -0
- package/dist/src/host-timeline.d.ts +24 -0
- package/dist/src/host-timeline.js +161 -0
- package/dist/src/jsonl.d.ts +13 -0
- package/dist/src/jsonl.js +47 -0
- package/dist/src/lifecycle.d.ts +5 -0
- package/dist/src/lifecycle.js +18 -0
- package/dist/src/message-routing.d.ts +32 -0
- package/dist/src/message-routing.js +119 -0
- package/dist/src/paths.d.ts +19 -0
- package/dist/src/paths.js +26 -0
- package/dist/src/project-profile.d.ts +49 -0
- package/dist/src/project-profile.js +356 -0
- package/dist/src/remediation.d.ts +14 -0
- package/dist/src/remediation.js +114 -0
- package/dist/src/remote-devices.d.ts +41 -0
- package/dist/src/remote-devices.js +156 -0
- package/dist/src/remote-diagnostics.d.ts +39 -0
- package/dist/src/remote-diagnostics.js +199 -0
- package/dist/src/remote-ssh.d.ts +39 -0
- package/dist/src/remote-ssh.js +129 -0
- package/dist/src/run-stream.d.ts +57 -0
- package/dist/src/run-stream.js +119 -0
- package/dist/src/runner.d.ts +131 -0
- package/dist/src/runner.js +1161 -0
- package/dist/src/runtime-data.d.ts +68 -0
- package/dist/src/runtime-data.js +172 -0
- package/dist/src/service.d.ts +114 -0
- package/dist/src/service.js +631 -0
- package/dist/src/shared-skills.d.ts +26 -0
- package/dist/src/shared-skills.js +85 -0
- package/dist/src/shim.d.ts +1 -0
- package/dist/src/shim.js +64 -0
- package/dist/src/skill-check.d.ts +17 -0
- package/dist/src/skill-check.js +158 -0
- package/dist/src/sse.d.ts +9 -0
- package/dist/src/sse.js +36 -0
- package/dist/src/team-routing.d.ts +55 -0
- package/dist/src/team-routing.js +131 -0
- package/dist/src/team-workflow.d.ts +78 -0
- package/dist/src/team-workflow.js +253 -0
- package/dist/src/text.d.ts +7 -0
- package/dist/src/text.js +27 -0
- package/dist/src/types.d.ts +98 -0
- package/dist/src/types.js +1 -0
- package/dist/src/usage.d.ts +116 -0
- package/dist/src/usage.js +350 -0
- package/dist/src/workspace.d.ts +9 -0
- package/dist/src/workspace.js +56 -0
- package/dist/src/worktree.d.ts +47 -0
- package/dist/src/worktree.js +201 -0
- package/package.json +63 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { AgentConfig, ComputerConfig, EngineId, TriageVerdict } from "./types.js";
|
|
2
|
+
import type { RunningAgentState } from "./service.js";
|
|
3
|
+
interface InboxRow {
|
|
4
|
+
id?: string;
|
|
5
|
+
conversation_id?: string;
|
|
6
|
+
conversation_title?: string;
|
|
7
|
+
conversation_kind?: string;
|
|
8
|
+
conversation_topic?: string;
|
|
9
|
+
author_name?: string;
|
|
10
|
+
author_kind?: string;
|
|
11
|
+
kind?: string;
|
|
12
|
+
body?: string;
|
|
13
|
+
attachments?: unknown;
|
|
14
|
+
priority?: string;
|
|
15
|
+
message_type?: string;
|
|
16
|
+
to_agent_id?: string;
|
|
17
|
+
created_at?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface WakeEventInfo {
|
|
20
|
+
conversationId: string | null;
|
|
21
|
+
agentId: string | null;
|
|
22
|
+
sentAt: number | null;
|
|
23
|
+
deliveryLatencyMs: number | null;
|
|
24
|
+
}
|
|
25
|
+
export declare class Semaphore {
|
|
26
|
+
private readonly max;
|
|
27
|
+
private inFlight;
|
|
28
|
+
private readonly waiters;
|
|
29
|
+
constructor(max: number);
|
|
30
|
+
acquire(): Promise<void>;
|
|
31
|
+
release(): void;
|
|
32
|
+
get queueDepth(): number;
|
|
33
|
+
}
|
|
34
|
+
export declare function sanitizeNestedEngineEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
35
|
+
export declare function selectSteerMessage(rows: InboxRow[], conversationId: string, agentId: string, lastSteeredMsgId?: string | null): InboxRow | null;
|
|
36
|
+
export declare function formatSteerPrompt(row: InboxRow, conversationId: string, agentId?: string): string;
|
|
37
|
+
export declare function buildStandingPrompt(workspaces?: string[], agentRoot?: string, worktreeNote?: string): string;
|
|
38
|
+
export declare function shouldStopEngineOnBeginStop(): boolean;
|
|
39
|
+
export declare function visibleEngineError(engine: EngineId, home: string, exitCode: number, detail?: string): string;
|
|
40
|
+
export declare function formatTriageNote(triage?: TriageVerdict | null): string;
|
|
41
|
+
export declare function buildChatDelta(digest: string, memoryDigest: string, rosterDigest: string, triage?: TriageVerdict | null): string;
|
|
42
|
+
export declare function buildAgendaDelta(brief: string, memoryDigest: string, rosterDigest: string): string;
|
|
43
|
+
export declare function buildRuntimePreambleSection(preamble?: string): string;
|
|
44
|
+
export declare function appendRuntimePreamble(delta: string, preamble?: string): string;
|
|
45
|
+
export declare function isContextOverflow(error: string): boolean;
|
|
46
|
+
export declare function isPoisonedTranscript(error: string): boolean;
|
|
47
|
+
export declare function mustResetSession(error: string, hadResume: boolean): boolean;
|
|
48
|
+
export declare function sessionResetReason(error: string): string;
|
|
49
|
+
export declare function swallowTurnRejection(task: Promise<void>, onError: (message: string) => void): void;
|
|
50
|
+
export declare function agentSessionFile(agentId: string, engine: EngineId): string;
|
|
51
|
+
export declare function parseWakeEventInfo(rawData: string | undefined, now?: number): WakeEventInfo;
|
|
52
|
+
export declare function shouldHandleWakeEvent(info: WakeEventInfo, agentId: string): boolean;
|
|
53
|
+
export declare class AgentRunner {
|
|
54
|
+
private readonly cfg;
|
|
55
|
+
private readonly agent;
|
|
56
|
+
private readonly availableEngines;
|
|
57
|
+
private readonly onStateChange?;
|
|
58
|
+
private readonly home;
|
|
59
|
+
private readonly binDir;
|
|
60
|
+
private readonly sessionFile;
|
|
61
|
+
private readonly adapter;
|
|
62
|
+
private token;
|
|
63
|
+
private tokenExpiresAt;
|
|
64
|
+
private pollTimer;
|
|
65
|
+
private wakeDebounceTimer;
|
|
66
|
+
private wakeStreamController;
|
|
67
|
+
private busy;
|
|
68
|
+
private pendingRerun;
|
|
69
|
+
private stopped;
|
|
70
|
+
private sessionId;
|
|
71
|
+
private engineSession;
|
|
72
|
+
private engineBackoffUntil;
|
|
73
|
+
private triageBackoffUntil;
|
|
74
|
+
private triageTroubleStreak;
|
|
75
|
+
private lastWakeConvo;
|
|
76
|
+
private lastTurnEndedAt;
|
|
77
|
+
private lastAgendaCheckAt;
|
|
78
|
+
private sideSteering;
|
|
79
|
+
private lastSteeredMsgId;
|
|
80
|
+
private runStats;
|
|
81
|
+
private lastBudgetEventState;
|
|
82
|
+
private sharedSkillSnapshot;
|
|
83
|
+
private hostHomeEntries;
|
|
84
|
+
private remediation;
|
|
85
|
+
constructor(cfg: ComputerConfig, agent: AgentConfig, engine: EngineId, availableEngines?: EngineId[], onStateChange?: (() => void) | undefined);
|
|
86
|
+
get isBusy(): boolean;
|
|
87
|
+
runningState(): RunningAgentState;
|
|
88
|
+
private configWarnings;
|
|
89
|
+
private notifyStateChange;
|
|
90
|
+
private workspaceRoot;
|
|
91
|
+
private worktreePlans;
|
|
92
|
+
configMatches(agent: AgentConfig, engine: EngineId): boolean;
|
|
93
|
+
start(): Promise<void>;
|
|
94
|
+
beginStop(): void;
|
|
95
|
+
stop(): void;
|
|
96
|
+
scheduleWake(reason: string, conversationId?: string | null): void;
|
|
97
|
+
private kickTurn;
|
|
98
|
+
private steerRunningTurn;
|
|
99
|
+
private maybeSteer;
|
|
100
|
+
private ensureToken;
|
|
101
|
+
private engineEnv;
|
|
102
|
+
private standingPrompt;
|
|
103
|
+
private memoryDigest;
|
|
104
|
+
private loadSessionId;
|
|
105
|
+
private setSessionId;
|
|
106
|
+
private clearSessionId;
|
|
107
|
+
private resetEngineSession;
|
|
108
|
+
private beatRun;
|
|
109
|
+
private failureConversationIds;
|
|
110
|
+
private publishEngineFailure;
|
|
111
|
+
private publishEvent;
|
|
112
|
+
private publishBudgetEvent;
|
|
113
|
+
private triageModel;
|
|
114
|
+
private recordTriageUsage;
|
|
115
|
+
private inboxTriage;
|
|
116
|
+
private snapshotUnread;
|
|
117
|
+
private ackSeen;
|
|
118
|
+
private rosterDigest;
|
|
119
|
+
private runtimePreamble;
|
|
120
|
+
private promptForTurn;
|
|
121
|
+
private promptForAgenda;
|
|
122
|
+
private logEngineLine;
|
|
123
|
+
private ensureEngineSession;
|
|
124
|
+
private runTurn;
|
|
125
|
+
private maybeAgendaTurn;
|
|
126
|
+
private streamLoop;
|
|
127
|
+
}
|
|
128
|
+
export declare function abortWakeStream(controller: AbortController | null): void;
|
|
129
|
+
export declare function replaceWakeStreamController(controller: AbortController | null): AbortController;
|
|
130
|
+
export declare function isWakeStreamAuthFailure(status: number): boolean;
|
|
131
|
+
export {};
|