@geteigen/cli 0.0.0-stage → 3.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/README.md +154 -2
- package/dist/agent.d.ts +32 -0
- package/dist/agent.js +246 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.js +33 -0
- package/dist/cli/src/agent.d.ts +24 -0
- package/dist/cli/src/agent.js +260 -0
- package/dist/cli/src/agentTools.d.ts +10 -0
- package/dist/cli/src/agentTools.js +70 -0
- package/dist/cli/src/auth.d.ts +5 -0
- package/dist/cli/src/auth.js +33 -0
- package/dist/cli/src/config.d.ts +11 -0
- package/dist/cli/src/config.js +51 -0
- package/dist/cli/src/cursorAuth.d.ts +10 -0
- package/dist/cli/src/cursorAuth.js +92 -0
- package/dist/cli/src/index.d.ts +2 -0
- package/dist/cli/src/index.js +244 -0
- package/dist/cli/src/listModels.d.ts +14 -0
- package/dist/cli/src/listModels.js +196 -0
- package/dist/cli/src/listSessions.d.ts +9 -0
- package/dist/cli/src/listSessions.js +37 -0
- package/dist/cli/src/machineConfig.d.ts +20 -0
- package/dist/cli/src/machineConfig.js +66 -0
- package/dist/cli/src/pickFolder.d.ts +5 -0
- package/dist/cli/src/pickFolder.js +65 -0
- package/dist/cli/src/proc.d.ts +23 -0
- package/dist/cli/src/proc.js +77 -0
- package/dist/cli/src/service.d.ts +17 -0
- package/dist/cli/src/service.js +246 -0
- package/dist/cli/src/workRoots.d.ts +30 -0
- package/dist/cli/src/workRoots.js +221 -0
- package/dist/cli/src/worker.d.ts +8 -0
- package/dist/cli/src/worker.js +51 -0
- package/dist/cli/src/workerCore.d.ts +47 -0
- package/dist/cli/src/workerCore.js +702 -0
- package/dist/cli/src/workspace.d.ts +8 -0
- package/dist/cli/src/workspace.js +269 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +51 -0
- package/dist/cursorAuth.d.ts +10 -0
- package/dist/cursorAuth.js +95 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +108 -0
- package/dist/listModels.d.ts +6 -0
- package/dist/listModels.js +62 -0
- package/dist/listSessions.d.ts +9 -0
- package/dist/listSessions.js +37 -0
- package/dist/pickFolder.d.ts +5 -0
- package/dist/pickFolder.js +65 -0
- package/dist/shared/actionDrafts.d.ts +83 -0
- package/dist/shared/actionDrafts.js +169 -0
- package/dist/shared/agentArtifacts.d.ts +49 -0
- package/dist/shared/agentArtifacts.js +169 -0
- package/dist/shared/agentLabel.d.ts +18 -0
- package/dist/shared/agentLabel.js +22 -0
- package/dist/shared/agentMentions.d.ts +38 -0
- package/dist/shared/agentMentions.js +110 -0
- package/dist/shared/agentRepos.d.ts +28 -0
- package/dist/shared/agentRepos.js +60 -0
- package/dist/shared/agentRunStatus.d.ts +12 -0
- package/dist/shared/agentRunStatus.js +17 -0
- package/dist/shared/agentUsage.d.ts +24 -0
- package/dist/shared/agentUsage.js +139 -0
- package/dist/shared/approvals.d.ts +44 -0
- package/dist/shared/approvals.js +97 -0
- package/dist/shared/askEigen.d.ts +190 -0
- package/dist/shared/askEigen.js +76 -0
- package/dist/shared/attribution.d.ts +25 -0
- package/dist/shared/attribution.js +63 -0
- package/dist/shared/automations.d.ts +136 -0
- package/dist/shared/automations.js +546 -0
- package/dist/shared/backends/claudeCode.d.ts +42 -0
- package/dist/shared/backends/claudeCode.js +540 -0
- package/dist/shared/backends/codex.d.ts +15 -0
- package/dist/shared/backends/codex.js +287 -0
- package/dist/shared/backends/cursor.d.ts +102 -0
- package/dist/shared/backends/cursor.js +1197 -0
- package/dist/shared/backends/index.d.ts +18 -0
- package/dist/shared/backends/index.js +58 -0
- package/dist/shared/backends/opencode.d.ts +40 -0
- package/dist/shared/backends/opencode.js +397 -0
- package/dist/shared/backends/types.d.ts +171 -0
- package/dist/shared/backends/types.js +19 -0
- package/dist/shared/backends/usage.d.ts +8 -0
- package/dist/shared/backends/usage.js +71 -0
- package/dist/shared/billingPlans.d.ts +60 -0
- package/dist/shared/billingPlans.js +262 -0
- package/dist/shared/brain.d.ts +353 -0
- package/dist/shared/brain.js +487 -0
- package/dist/shared/clarifyingQuestions.d.ts +13 -0
- package/dist/shared/clarifyingQuestions.js +207 -0
- package/dist/shared/claudeModels.d.ts +10 -0
- package/dist/shared/claudeModels.js +52 -0
- package/dist/shared/cloudBackends.d.ts +21 -0
- package/dist/shared/cloudBackends.js +29 -0
- package/dist/shared/codexModels.d.ts +10 -0
- package/dist/shared/codexModels.js +28 -0
- package/dist/shared/contextWindows.d.ts +2 -0
- package/dist/shared/contextWindows.js +30 -0
- package/dist/shared/cursorMcpConfig.d.ts +14 -0
- package/dist/shared/cursorMcpConfig.js +43 -0
- package/dist/shared/cursorProjectMcp.d.ts +10 -0
- package/dist/shared/cursorProjectMcp.js +42 -0
- package/dist/shared/docs.d.ts +59 -0
- package/dist/shared/docs.js +87 -0
- package/dist/shared/events.d.ts +929 -0
- package/dist/shared/events.js +59 -0
- package/dist/shared/integrations.d.ts +266 -0
- package/dist/shared/integrations.js +449 -0
- package/dist/shared/issueTranscript.d.ts +64 -0
- package/dist/shared/issueTranscript.js +387 -0
- package/dist/shared/issues.d.ts +139 -0
- package/dist/shared/issues.js +217 -0
- package/dist/shared/machines.d.ts +115 -0
- package/dist/shared/machines.js +58 -0
- package/dist/shared/markdownMedia.d.ts +13 -0
- package/dist/shared/markdownMedia.js +41 -0
- package/dist/shared/notificationText.d.ts +6 -0
- package/dist/shared/notificationText.js +38 -0
- package/dist/shared/opencodeModels.d.ts +19 -0
- package/dist/shared/opencodeModels.js +62 -0
- package/dist/shared/opencodeSession.d.ts +7 -0
- package/dist/shared/opencodeSession.js +30 -0
- package/dist/shared/orchestration.d.ts +58 -0
- package/dist/shared/orchestration.js +12 -0
- package/dist/shared/orgs.d.ts +47 -0
- package/dist/shared/orgs.js +49 -0
- package/dist/shared/personalOrg.d.ts +5 -0
- package/dist/shared/personalOrg.js +12 -0
- package/dist/shared/plans.d.ts +3 -0
- package/dist/shared/plans.js +19 -0
- package/dist/shared/providerModels.d.ts +40 -0
- package/dist/shared/providerModels.js +503 -0
- package/dist/shared/roomAttention.d.ts +17 -0
- package/dist/shared/roomAttention.js +36 -0
- package/dist/shared/roomContext.d.ts +120 -0
- package/dist/shared/roomContext.js +133 -0
- package/dist/shared/roomPermissions.d.ts +56 -0
- package/dist/shared/roomPermissions.js +133 -0
- package/dist/shared/sessionSeats.d.ts +29 -0
- package/dist/shared/sessionSeats.js +57 -0
- package/dist/shared/slashCommands.d.ts +39 -0
- package/dist/shared/slashCommands.js +166 -0
- package/dist/shared/space.d.ts +33 -0
- package/dist/shared/space.js +54 -0
- package/dist/shared/spaceFeed.d.ts +78 -0
- package/dist/shared/spaceFeed.js +194 -0
- package/dist/shared/stringifyUnknown.d.ts +1 -0
- package/dist/shared/stringifyUnknown.js +1 -0
- package/dist/shared/swarm.d.ts +320 -0
- package/dist/shared/swarm.js +328 -0
- package/dist/shared/swarmVisual.d.ts +79 -0
- package/dist/shared/swarmVisual.js +212 -0
- package/dist/shared/terminalFilter.d.ts +13 -0
- package/dist/shared/terminalFilter.js +46 -0
- package/dist/shared/toolIntegration.d.ts +56 -0
- package/dist/shared/toolIntegration.js +180 -0
- package/dist/shared/typing.d.ts +9 -0
- package/dist/shared/typing.js +37 -0
- package/dist/shared/uploads.d.ts +31 -0
- package/dist/shared/uploads.js +65 -0
- package/dist/shared/voiceApprovals.d.ts +36 -0
- package/dist/shared/voiceApprovals.js +229 -0
- package/dist/shared/workspace.d.ts +47 -0
- package/dist/shared/workspace.js +40 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +266 -0
- package/package.json +51 -4
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask Eigen — the workspace Q&A agent. Types shared by the server, web and
|
|
3
|
+
* desktop bundles. Questions are answered from the team brain (memories,
|
|
4
|
+
* episodes, rooms, features, PRs) and read-only connected tools, with a
|
|
5
|
+
* numbered source list and a receipt for every answer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ASK_PROVIDERS: readonly ["openai", "anthropic"];
|
|
8
|
+
export type AskProvider = (typeof ASK_PROVIDERS)[number];
|
|
9
|
+
export type AskThreadSource = "page" | "room" | "issue" | "palette";
|
|
10
|
+
export interface AskSettings {
|
|
11
|
+
/** Owners/admins can turn the whole feature off for a workspace. */
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
/** Room chats and their captured episodes. */
|
|
14
|
+
includeRooms: boolean;
|
|
15
|
+
/** Private-room content, only when the asker is already a member. */
|
|
16
|
+
includePrivateRooms: boolean;
|
|
17
|
+
/** Read-only connected tools (Notion, Linear, GitHub, Sentry, …). */
|
|
18
|
+
includeIntegrations: boolean;
|
|
19
|
+
/** Days to keep the admin audit log. */
|
|
20
|
+
retentionDays: number;
|
|
21
|
+
provider: AskProvider;
|
|
22
|
+
model: string;
|
|
23
|
+
/** Maximum numbered sources handed to the model (3–18). */
|
|
24
|
+
maxSources: number;
|
|
25
|
+
/** Admin override of the plan's daily question cap; null = plan default. */
|
|
26
|
+
dailyLimitOverride: number | null;
|
|
27
|
+
}
|
|
28
|
+
export declare const DEFAULT_ASK_SETTINGS: AskSettings;
|
|
29
|
+
export declare function defaultAskModel(provider: AskProvider): string;
|
|
30
|
+
export declare function isAskProvider(v: unknown): v is AskProvider;
|
|
31
|
+
/** Tolerant normalization — stored JSON may predate newer fields. */
|
|
32
|
+
export declare function normalizeAskSettings(raw: unknown): AskSettings;
|
|
33
|
+
/** Per-plan daily question caps. Kept here so web can show the same number. */
|
|
34
|
+
export declare const ASK_PLAN_DAILY_CAPS: Record<string, number>;
|
|
35
|
+
export declare function askDailyCap(plan: string | null | undefined, override: number | null): number;
|
|
36
|
+
export type AskCitationKind = "memory" | "event" | "feature" | "person" | "integration" | "room" | "issue";
|
|
37
|
+
export interface AskSource {
|
|
38
|
+
/** 1-based marker used in the answer. */
|
|
39
|
+
n: number;
|
|
40
|
+
kind: AskCitationKind;
|
|
41
|
+
id: string | null;
|
|
42
|
+
title: string;
|
|
43
|
+
subtitle: string;
|
|
44
|
+
snippet: string;
|
|
45
|
+
/** Internal route or external URL; null when there is no detail page. */
|
|
46
|
+
href: string | null;
|
|
47
|
+
at: number | null;
|
|
48
|
+
/** Retrieval score (memories similarity, other sources heuristically ranked). */
|
|
49
|
+
score: number;
|
|
50
|
+
/** Whether the answer cited this source. */
|
|
51
|
+
used: boolean;
|
|
52
|
+
}
|
|
53
|
+
export type AskToolStatus = "ok" | "empty" | "error" | "skipped";
|
|
54
|
+
export interface AskToolTrace {
|
|
55
|
+
name: string;
|
|
56
|
+
status: AskToolStatus;
|
|
57
|
+
count: number;
|
|
58
|
+
ms: number;
|
|
59
|
+
detail?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface AskReceipt {
|
|
62
|
+
at: number;
|
|
63
|
+
latencyMs: number;
|
|
64
|
+
provider: string | null;
|
|
65
|
+
model: string | null;
|
|
66
|
+
inputTokens: number;
|
|
67
|
+
outputTokens: number;
|
|
68
|
+
outcome: AskOutcome;
|
|
69
|
+
scopes: string[];
|
|
70
|
+
tools: AskToolTrace[];
|
|
71
|
+
counts: {
|
|
72
|
+
memories: number;
|
|
73
|
+
events: number;
|
|
74
|
+
features: number;
|
|
75
|
+
people: number;
|
|
76
|
+
integrations: number;
|
|
77
|
+
};
|
|
78
|
+
memoryIds: string[];
|
|
79
|
+
privateRoomsExcluded: number;
|
|
80
|
+
}
|
|
81
|
+
export interface AskReceiptDetail extends AskReceipt {
|
|
82
|
+
sources: AskSource[];
|
|
83
|
+
}
|
|
84
|
+
export type AskOutcome = "answered" | "empty" | "fallback" | "limited" | "disabled" | "error";
|
|
85
|
+
export type AskFeedbackValue = "up" | "down" | "correction";
|
|
86
|
+
export interface AskMessageInfo {
|
|
87
|
+
id: string;
|
|
88
|
+
threadId: string;
|
|
89
|
+
role: "user" | "assistant";
|
|
90
|
+
content: string;
|
|
91
|
+
citations: number[];
|
|
92
|
+
sources: AskSource[];
|
|
93
|
+
receipt: AskReceipt | null;
|
|
94
|
+
provider: string | null;
|
|
95
|
+
model: string | null;
|
|
96
|
+
inputTokens: number;
|
|
97
|
+
outputTokens: number;
|
|
98
|
+
latencyMs: number;
|
|
99
|
+
createdAt: number;
|
|
100
|
+
/** The signed-in user's latest feedback on this answer. */
|
|
101
|
+
feedback?: AskFeedbackValue | null;
|
|
102
|
+
}
|
|
103
|
+
export interface AskThreadInfo {
|
|
104
|
+
id: string;
|
|
105
|
+
orgId: string;
|
|
106
|
+
userId: string;
|
|
107
|
+
title: string;
|
|
108
|
+
source: AskThreadSource;
|
|
109
|
+
roomId: string | null;
|
|
110
|
+
issueId: string | null;
|
|
111
|
+
createdAt: number;
|
|
112
|
+
updatedAt: number;
|
|
113
|
+
messageCount: number;
|
|
114
|
+
lastQuestion: string | null;
|
|
115
|
+
}
|
|
116
|
+
export interface AskThreadDetail {
|
|
117
|
+
thread: AskThreadInfo;
|
|
118
|
+
messages: AskMessageInfo[];
|
|
119
|
+
}
|
|
120
|
+
export interface AskSettingsResponse {
|
|
121
|
+
settings: AskSettings;
|
|
122
|
+
canManage: boolean;
|
|
123
|
+
plan: string;
|
|
124
|
+
dailyCap: number;
|
|
125
|
+
usedToday: number;
|
|
126
|
+
questionsToday: number;
|
|
127
|
+
brainConfigured: boolean;
|
|
128
|
+
modelConfigured: boolean;
|
|
129
|
+
/** Providers with a server-managed Ask Eigen key available. */
|
|
130
|
+
availableProviders: AskProvider[];
|
|
131
|
+
}
|
|
132
|
+
export interface AskDigestHighlight {
|
|
133
|
+
label: string;
|
|
134
|
+
title: string;
|
|
135
|
+
href: string | null;
|
|
136
|
+
at: number;
|
|
137
|
+
}
|
|
138
|
+
export interface AskDigestInfo {
|
|
139
|
+
kind: "day" | "week" | "none";
|
|
140
|
+
period: string | null;
|
|
141
|
+
summary: string;
|
|
142
|
+
highlights: AskDigestHighlight[];
|
|
143
|
+
needsYou: AskDigestHighlight[];
|
|
144
|
+
generatedAt: number | null;
|
|
145
|
+
}
|
|
146
|
+
export interface AskAuditInfo {
|
|
147
|
+
id: string;
|
|
148
|
+
userId: string;
|
|
149
|
+
userName: string | null;
|
|
150
|
+
threadId: string | null;
|
|
151
|
+
question: string;
|
|
152
|
+
outcome: AskOutcome;
|
|
153
|
+
provider: string | null;
|
|
154
|
+
model: string | null;
|
|
155
|
+
citationCount: number;
|
|
156
|
+
sourceCount: number;
|
|
157
|
+
inputTokens: number;
|
|
158
|
+
outputTokens: number;
|
|
159
|
+
latencyMs: number;
|
|
160
|
+
createdAt: number;
|
|
161
|
+
}
|
|
162
|
+
export interface AskFeedbackResponse {
|
|
163
|
+
rating: AskFeedbackValue;
|
|
164
|
+
memoryId: string | null;
|
|
165
|
+
}
|
|
166
|
+
export declare const ASK_QUESTION_MAX = 1000;
|
|
167
|
+
/** SSE payloads from `POST /api/ask-eigen/:orgId/ask`. */
|
|
168
|
+
export type AskStreamEvent = {
|
|
169
|
+
type: "meta";
|
|
170
|
+
threadId: string;
|
|
171
|
+
userMessageId: string;
|
|
172
|
+
} | {
|
|
173
|
+
type: "status";
|
|
174
|
+
stage: "searching" | "reading" | "writing" | "saving";
|
|
175
|
+
} | {
|
|
176
|
+
type: "sources";
|
|
177
|
+
sources: AskSource[];
|
|
178
|
+
} | {
|
|
179
|
+
type: "delta";
|
|
180
|
+
text: string;
|
|
181
|
+
} | {
|
|
182
|
+
type: "done";
|
|
183
|
+
message: AskMessageInfo;
|
|
184
|
+
thread: AskThreadInfo;
|
|
185
|
+
} | {
|
|
186
|
+
type: "error";
|
|
187
|
+
error: string;
|
|
188
|
+
};
|
|
189
|
+
/** Suggested prompts shown on an empty thread. */
|
|
190
|
+
export declare const ASK_SUGGESTIONS: string[];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask Eigen — the workspace Q&A agent. Types shared by the server, web and
|
|
3
|
+
* desktop bundles. Questions are answered from the team brain (memories,
|
|
4
|
+
* episodes, rooms, features, PRs) and read-only connected tools, with a
|
|
5
|
+
* numbered source list and a receipt for every answer.
|
|
6
|
+
*/
|
|
7
|
+
export const ASK_PROVIDERS = ["openai", "anthropic"];
|
|
8
|
+
export const DEFAULT_ASK_SETTINGS = {
|
|
9
|
+
enabled: true,
|
|
10
|
+
includeRooms: true,
|
|
11
|
+
includePrivateRooms: false,
|
|
12
|
+
includeIntegrations: true,
|
|
13
|
+
retentionDays: 90,
|
|
14
|
+
provider: "openai",
|
|
15
|
+
model: "gpt-4.1-mini",
|
|
16
|
+
maxSources: 10,
|
|
17
|
+
dailyLimitOverride: null,
|
|
18
|
+
};
|
|
19
|
+
const PROVIDER_DEFAULT_MODEL = {
|
|
20
|
+
openai: "gpt-4.1-mini",
|
|
21
|
+
anthropic: "claude-sonnet-4-5",
|
|
22
|
+
};
|
|
23
|
+
export function defaultAskModel(provider) {
|
|
24
|
+
return PROVIDER_DEFAULT_MODEL[provider];
|
|
25
|
+
}
|
|
26
|
+
function bool(v, fallback) {
|
|
27
|
+
return typeof v === "boolean" ? v : fallback;
|
|
28
|
+
}
|
|
29
|
+
function num(v, fallback, min, max) {
|
|
30
|
+
const n = typeof v === "number" ? v : Number(v);
|
|
31
|
+
if (!Number.isFinite(n))
|
|
32
|
+
return fallback;
|
|
33
|
+
return Math.min(max, Math.max(min, Math.round(n)));
|
|
34
|
+
}
|
|
35
|
+
export function isAskProvider(v) {
|
|
36
|
+
return typeof v === "string" && ASK_PROVIDERS.includes(v);
|
|
37
|
+
}
|
|
38
|
+
/** Tolerant normalization — stored JSON may predate newer fields. */
|
|
39
|
+
export function normalizeAskSettings(raw) {
|
|
40
|
+
const r = raw && typeof raw === "object" ? raw : {};
|
|
41
|
+
const provider = isAskProvider(r.provider) ? r.provider : DEFAULT_ASK_SETTINGS.provider;
|
|
42
|
+
const model = typeof r.model === "string" && r.model.trim() ? r.model.trim().slice(0, 80) : defaultAskModel(provider);
|
|
43
|
+
const override = r.dailyLimitOverride;
|
|
44
|
+
return {
|
|
45
|
+
enabled: bool(r.enabled, DEFAULT_ASK_SETTINGS.enabled),
|
|
46
|
+
includeRooms: bool(r.includeRooms, DEFAULT_ASK_SETTINGS.includeRooms),
|
|
47
|
+
includePrivateRooms: bool(r.includePrivateRooms, DEFAULT_ASK_SETTINGS.includePrivateRooms),
|
|
48
|
+
includeIntegrations: bool(r.includeIntegrations, DEFAULT_ASK_SETTINGS.includeIntegrations),
|
|
49
|
+
retentionDays: num(r.retentionDays, DEFAULT_ASK_SETTINGS.retentionDays, 7, 365),
|
|
50
|
+
provider,
|
|
51
|
+
model,
|
|
52
|
+
maxSources: num(r.maxSources, DEFAULT_ASK_SETTINGS.maxSources, 3, 18),
|
|
53
|
+
dailyLimitOverride: override === null || override === undefined || override === ""
|
|
54
|
+
? null
|
|
55
|
+
: num(override, 100, 1, 10_000),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Per-plan daily question caps. Kept here so web can show the same number. */
|
|
59
|
+
export const ASK_PLAN_DAILY_CAPS = {
|
|
60
|
+
free: 25,
|
|
61
|
+
team: 500,
|
|
62
|
+
business: 2000,
|
|
63
|
+
};
|
|
64
|
+
export function askDailyCap(plan, override) {
|
|
65
|
+
if (typeof override === "number" && Number.isFinite(override) && override > 0)
|
|
66
|
+
return override;
|
|
67
|
+
return ASK_PLAN_DAILY_CAPS[plan || "free"] ?? ASK_PLAN_DAILY_CAPS.free;
|
|
68
|
+
}
|
|
69
|
+
export const ASK_QUESTION_MAX = 1000;
|
|
70
|
+
/** Suggested prompts shown on an empty thread. */
|
|
71
|
+
export const ASK_SUGGESTIONS = [
|
|
72
|
+
"What shipped this week?",
|
|
73
|
+
"What did we decide about pricing?",
|
|
74
|
+
"Who worked on auth recently?",
|
|
75
|
+
"What needs my attention today?",
|
|
76
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git attribution helpers — turn Steer chat authorship into commit metadata
|
|
3
|
+
* that shows up in git blame / PR review.
|
|
4
|
+
*/
|
|
5
|
+
export interface SteerAuthor {
|
|
6
|
+
userId?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Normalize a display name into a noreply-style local-part. */
|
|
11
|
+
export declare function noreplyLocalPart(name: string, userId?: string): string;
|
|
12
|
+
export declare function resolveAuthorEmail(author: SteerAuthor): string;
|
|
13
|
+
export declare function formatCoAuthoredBy(author: SteerAuthor): string;
|
|
14
|
+
/**
|
|
15
|
+
* Full commit message with optional Co-authored-by trailer.
|
|
16
|
+
* Trailers must be separated from the subject/body by a blank line.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildAttributedCommitMessage(summary: string, steeredBy?: SteerAuthor | null): string;
|
|
19
|
+
/**
|
|
20
|
+
* Instruction injected into agent prompts so local Cursor/Claude CLI runs
|
|
21
|
+
* (where we don't control git commit ourselves) still attribute the steerer.
|
|
22
|
+
*/
|
|
23
|
+
export declare function attributionPromptSuffix(steeredBy?: SteerAuthor | null): string;
|
|
24
|
+
/** Short line for PR bodies / chat system notes. */
|
|
25
|
+
export declare function steeredByLine(steeredBy?: SteerAuthor | null): string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git attribution helpers — turn Steer chat authorship into commit metadata
|
|
3
|
+
* that shows up in git blame / PR review.
|
|
4
|
+
*/
|
|
5
|
+
/** Normalize a display name into a noreply-style local-part. */
|
|
6
|
+
export function noreplyLocalPart(name, userId) {
|
|
7
|
+
const slug = name
|
|
8
|
+
.trim()
|
|
9
|
+
.toLowerCase()
|
|
10
|
+
.replace(/[^a-z0-9]+/g, ".")
|
|
11
|
+
.replace(/^\.+|\.+$/g, "")
|
|
12
|
+
.slice(0, 40);
|
|
13
|
+
if (userId?.trim()) {
|
|
14
|
+
const id = userId.trim().replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 24);
|
|
15
|
+
return `${id}+${slug || "steer-user"}`;
|
|
16
|
+
}
|
|
17
|
+
return slug || "steer-user";
|
|
18
|
+
}
|
|
19
|
+
export function resolveAuthorEmail(author) {
|
|
20
|
+
const email = author.email?.trim();
|
|
21
|
+
if (email && email.includes("@"))
|
|
22
|
+
return email;
|
|
23
|
+
return `${noreplyLocalPart(author.name, author.userId)}@users.noreply.github.com`;
|
|
24
|
+
}
|
|
25
|
+
export function formatCoAuthoredBy(author) {
|
|
26
|
+
const name = author.name.trim() || "Steer user";
|
|
27
|
+
return `Co-authored-by: ${name} <${resolveAuthorEmail(author)}>`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Full commit message with optional Co-authored-by trailer.
|
|
31
|
+
* Trailers must be separated from the subject/body by a blank line.
|
|
32
|
+
*/
|
|
33
|
+
export function buildAttributedCommitMessage(summary, steeredBy) {
|
|
34
|
+
const subject = (summary || "steer: agent changes").trim().slice(0, 72);
|
|
35
|
+
if (!steeredBy?.name?.trim())
|
|
36
|
+
return subject;
|
|
37
|
+
return `${subject}\n\n${formatCoAuthoredBy(steeredBy)}`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Instruction injected into agent prompts so local Cursor/Claude CLI runs
|
|
41
|
+
* (where we don't control git commit ourselves) still attribute the steerer.
|
|
42
|
+
*/
|
|
43
|
+
export function attributionPromptSuffix(steeredBy) {
|
|
44
|
+
if (!steeredBy?.name?.trim())
|
|
45
|
+
return "";
|
|
46
|
+
const trailer = formatCoAuthoredBy(steeredBy);
|
|
47
|
+
return [
|
|
48
|
+
"",
|
|
49
|
+
"[Steer attribution]",
|
|
50
|
+
"When you create a git commit for this work, include this exact trailer",
|
|
51
|
+
"at the end of the commit message (after a blank line):",
|
|
52
|
+
"",
|
|
53
|
+
trailer,
|
|
54
|
+
"",
|
|
55
|
+
"Do not invent other co-authors. Keep the subject line concise.",
|
|
56
|
+
].join("\n");
|
|
57
|
+
}
|
|
58
|
+
/** Short line for PR bodies / chat system notes. */
|
|
59
|
+
export function steeredByLine(steeredBy) {
|
|
60
|
+
if (!steeredBy?.name?.trim())
|
|
61
|
+
return "";
|
|
62
|
+
return `Steered by: ${steeredBy.name.trim()} <${resolveAuthorEmail(steeredBy)}>`;
|
|
63
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export declare const AUTOMATION_MODES: readonly ["auto", "approval", "suggest_only"];
|
|
2
|
+
export type AutomationMode = (typeof AUTOMATION_MODES)[number];
|
|
3
|
+
export declare const TRIGGER_KINDS: readonly ["schedule", "composio_event", "manual"];
|
|
4
|
+
export type AutomationTriggerKind = (typeof TRIGGER_KINDS)[number];
|
|
5
|
+
export declare const MISFIRE_POLICIES: readonly ["skip", "run_once", "catch_up"];
|
|
6
|
+
export type MisfirePolicy = (typeof MISFIRE_POLICIES)[number];
|
|
7
|
+
export type AutomationRunStatus = "queued" | "running" | "awaiting_approval" | "completed" | "failed" | "cancelled";
|
|
8
|
+
export interface AutomationPolicy {
|
|
9
|
+
/** Hard daily cap for agent runs across every trigger on this automation. */
|
|
10
|
+
maxRunsPerDay: number;
|
|
11
|
+
/** Pending tool approvals expire after this many hours. */
|
|
12
|
+
approvalTtlHours: number;
|
|
13
|
+
/** A run that exceeds this wall-clock budget is stopped. */
|
|
14
|
+
maxRunMinutes: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_AUTOMATION_POLICY: AutomationPolicy;
|
|
17
|
+
/** `maxRunsPerDay` is enforced over this rolling window, independent of any timezone. */
|
|
18
|
+
export declare const RUN_LIMIT_WINDOW_MS: number;
|
|
19
|
+
/**
|
|
20
|
+
* The reference instant INTERVAL counts from (RFC 5545 DTSTART). Stored in the
|
|
21
|
+
* trigger config when the schedule is set; older triggers fall back to creation.
|
|
22
|
+
*/
|
|
23
|
+
export declare function scheduleAnchorOf(config: Record<string, unknown>, fallback: number): number;
|
|
24
|
+
export interface ComposioTriggerConfig {
|
|
25
|
+
connectionId: string;
|
|
26
|
+
triggerSlug: string;
|
|
27
|
+
triggerConfig?: Record<string, unknown>;
|
|
28
|
+
concurrencyKey?: string;
|
|
29
|
+
}
|
|
30
|
+
export type EventFilterCondition = {
|
|
31
|
+
path: string;
|
|
32
|
+
equals?: unknown;
|
|
33
|
+
contains?: unknown;
|
|
34
|
+
exists?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export interface EventFilter {
|
|
37
|
+
all?: EventFilterCondition[];
|
|
38
|
+
any?: EventFilterCondition[];
|
|
39
|
+
}
|
|
40
|
+
export declare function isAutomationMode(value: unknown): value is AutomationMode;
|
|
41
|
+
export declare function parseAutomationMode(value: unknown, fallback?: AutomationMode): AutomationMode;
|
|
42
|
+
export declare function isTriggerKind(value: unknown): value is AutomationTriggerKind;
|
|
43
|
+
export declare function parseTriggerKind(value: unknown): AutomationTriggerKind | null;
|
|
44
|
+
export declare function isMisfirePolicy(value: unknown): value is MisfirePolicy;
|
|
45
|
+
export declare function parseMisfirePolicy(value: unknown): MisfirePolicy;
|
|
46
|
+
export declare function isRunTerminal(status: AutomationRunStatus): boolean;
|
|
47
|
+
export declare function automationNeedsApproval(mode: AutomationMode): boolean;
|
|
48
|
+
export declare function automationAllowsWrites(mode: AutomationMode): boolean;
|
|
49
|
+
export declare function sanitizeAutomationName(raw: unknown): string;
|
|
50
|
+
export declare function sanitizeAutomationPrompt(raw: unknown): string;
|
|
51
|
+
export declare function sanitizeAutomationText(raw: unknown, max?: number): string;
|
|
52
|
+
export declare function normalizeAutomationPolicy(raw: unknown): AutomationPolicy;
|
|
53
|
+
export declare function normalizeEventFilter(raw: unknown): EventFilter | undefined;
|
|
54
|
+
export declare function matchesEventFilter(payload: unknown, filter: EventFilter | undefined): boolean;
|
|
55
|
+
export declare function expandConcurrencyKey(template: string | undefined, triggerId: string, payload: unknown): string;
|
|
56
|
+
export interface AutomationPromptInput {
|
|
57
|
+
automationId: string;
|
|
58
|
+
runId: string;
|
|
59
|
+
name: string;
|
|
60
|
+
prompt: string;
|
|
61
|
+
mode: AutomationMode;
|
|
62
|
+
policy: AutomationPolicy;
|
|
63
|
+
now: number;
|
|
64
|
+
event: unknown;
|
|
65
|
+
source: string;
|
|
66
|
+
previousAttempt?: string;
|
|
67
|
+
/** `<steer_artifacts>` block telling the agent how to share files it creates. */
|
|
68
|
+
artifactRules?: string;
|
|
69
|
+
/** The automation's memory doc: read first, log to before finishing. */
|
|
70
|
+
trackingDoc?: TrackingDocRef | null;
|
|
71
|
+
approvedToolCalls?: Array<{
|
|
72
|
+
toolName: string;
|
|
73
|
+
detail: string;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
export declare function buildAutomationPrompt(input: AutomationPromptInput): string;
|
|
77
|
+
export interface TrackingDocRef {
|
|
78
|
+
id: string;
|
|
79
|
+
title: string;
|
|
80
|
+
url: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* How a run uses its automation's tracking doc. The doc is the memory
|
|
84
|
+
* between runs for both fresh agents and room agents.
|
|
85
|
+
*/
|
|
86
|
+
export declare function trackingDocRules(doc: TrackingDocRef): string;
|
|
87
|
+
/**
|
|
88
|
+
* The turn an automation sends to the room agent it runs as. The agent keeps
|
|
89
|
+
* its conversation, so this is short: what to do now, plus any event data.
|
|
90
|
+
*/
|
|
91
|
+
export declare function buildRoomRunMessage(input: {
|
|
92
|
+
name: string;
|
|
93
|
+
prompt: string;
|
|
94
|
+
source: string;
|
|
95
|
+
event: unknown;
|
|
96
|
+
mode?: "auto" | "approval" | "suggest_only";
|
|
97
|
+
trackingDoc?: TrackingDocRef | null;
|
|
98
|
+
}): string;
|
|
99
|
+
/** Sent to a resumed session after a paused write was approved. */
|
|
100
|
+
export declare function buildApprovalContinuationPrompt(approvedToolCalls: Array<{
|
|
101
|
+
toolName: string;
|
|
102
|
+
detail: string;
|
|
103
|
+
}>): string;
|
|
104
|
+
export declare function summarizeAutomationOutput(raw: string | null | undefined, max?: number): string;
|
|
105
|
+
/**
|
|
106
|
+
* What the activity timeline should say. The run's report stays on the run;
|
|
107
|
+
* older events stored that report in the message, so those collapse to a status.
|
|
108
|
+
*/
|
|
109
|
+
export declare function automationActivityMessage(event: {
|
|
110
|
+
kind: string;
|
|
111
|
+
message?: string | null;
|
|
112
|
+
}): string;
|
|
113
|
+
interface RruleSpec {
|
|
114
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
115
|
+
interval: number;
|
|
116
|
+
byHour: number[];
|
|
117
|
+
byMinute: number[];
|
|
118
|
+
byDay: number[];
|
|
119
|
+
byMonthDay: number[];
|
|
120
|
+
/** WKST: first day of the week (0 = Sunday); decides which weeks INTERVAL skips. */
|
|
121
|
+
weekStart: number;
|
|
122
|
+
}
|
|
123
|
+
export declare function parseRrule(input: string): RruleSpec;
|
|
124
|
+
/**
|
|
125
|
+
* Next occurrence strictly after `after`. INTERVAL periods are counted from
|
|
126
|
+
* `anchor` (the schedule's DTSTART), so the cadence stays fixed no matter
|
|
127
|
+
* which instant the search starts from, e.g. when catching up after downtime.
|
|
128
|
+
*/
|
|
129
|
+
export declare function nextScheduledAt(input: {
|
|
130
|
+
rrule: string;
|
|
131
|
+
timeZone: string;
|
|
132
|
+
after: number;
|
|
133
|
+
anchor?: number;
|
|
134
|
+
}): number | null;
|
|
135
|
+
export declare function assertValidSchedule(rrule: string, timeZone: string, after?: number, anchor?: number): number;
|
|
136
|
+
export {};
|