@botiverse/raft-daemon 0.64.0 → 0.65.0-play.20260630143140
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/dist/{chunk-ILFE5NTJ.js → chunk-YAQHU63I.js} +210 -62
- package/dist/cli/index.js +164 -50
- package/dist/core.js +5 -1
- package/dist/{dist-TPCGG5OS.js → dist-TE3PBFBX.js} +160 -50
- package/dist/index.js +5 -3
- package/package.json +1 -1
|
@@ -820,17 +820,26 @@ function projectApmHeldFreshnessActivity(input) {
|
|
|
820
820
|
countLine,
|
|
821
821
|
...decisionLines
|
|
822
822
|
].filter((line) => Boolean(line)).join("\n");
|
|
823
|
+
const statusEntry = {
|
|
824
|
+
kind: "status",
|
|
825
|
+
activity: "working",
|
|
826
|
+
detail: title,
|
|
827
|
+
producerFactId: input.producerFactId
|
|
828
|
+
};
|
|
829
|
+
const entry = {
|
|
830
|
+
kind: "slock_action",
|
|
831
|
+
producerFactId: input.producerFactId,
|
|
832
|
+
title,
|
|
833
|
+
text
|
|
834
|
+
};
|
|
823
835
|
return {
|
|
824
836
|
clauseId: "SMR-006",
|
|
825
837
|
projector: "held-envelope",
|
|
826
838
|
surface: "agent:activity",
|
|
827
839
|
producerFactId: input.producerFactId,
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
title,
|
|
832
|
-
text
|
|
833
|
-
}
|
|
840
|
+
statusEntry,
|
|
841
|
+
entry,
|
|
842
|
+
entries: [statusEntry, entry]
|
|
834
843
|
};
|
|
835
844
|
}
|
|
836
845
|
function projectApmFreshnessDecisionTrace(input) {
|
|
@@ -2257,6 +2266,21 @@ var agentApiChannelMembersResponseSchema = passthroughObject({
|
|
|
2257
2266
|
role: optionalStringSchema
|
|
2258
2267
|
}))
|
|
2259
2268
|
});
|
|
2269
|
+
var agentApiChannelMuteResponseSchema = passthroughObject({
|
|
2270
|
+
activityMuted: optionalBooleanSchema,
|
|
2271
|
+
muteFromSeq: nullableNumberSchema.optional(),
|
|
2272
|
+
attention: passthroughObject({
|
|
2273
|
+
state: optionalStringSchema,
|
|
2274
|
+
ordinaryActivity: optionalStringSchema,
|
|
2275
|
+
unmuteCommand: optionalStringSchema,
|
|
2276
|
+
unmuteApi: optionalStringSchema,
|
|
2277
|
+
muteCommand: optionalStringSchema,
|
|
2278
|
+
muteApi: optionalStringSchema,
|
|
2279
|
+
stillArrives: optionalStringArraySchema,
|
|
2280
|
+
threadBoundary: optionalStringSchema,
|
|
2281
|
+
catchUp: optionalStringSchema
|
|
2282
|
+
}).optional()
|
|
2283
|
+
});
|
|
2260
2284
|
var agentApiTaskClaimResultSchema = passthroughObject({
|
|
2261
2285
|
taskNumber: z2.number().int().positive().optional(),
|
|
2262
2286
|
messageId: optionalStringSchema,
|
|
@@ -2439,6 +2463,26 @@ var agentApiContract = {
|
|
|
2439
2463
|
request: { params: agentApiChannelMembershipParamsSchema },
|
|
2440
2464
|
response: { body: agentApiOkResponseSchema }
|
|
2441
2465
|
}),
|
|
2466
|
+
channelMute: route({
|
|
2467
|
+
key: "channelMute",
|
|
2468
|
+
method: "POST",
|
|
2469
|
+
path: "/channels/:channelId/mute",
|
|
2470
|
+
client: { resource: "channels", method: "mute" },
|
|
2471
|
+
capability: "channels",
|
|
2472
|
+
description: "Mute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
2473
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
2474
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
2475
|
+
}),
|
|
2476
|
+
channelUnmute: route({
|
|
2477
|
+
key: "channelUnmute",
|
|
2478
|
+
method: "POST",
|
|
2479
|
+
path: "/channels/:channelId/unmute",
|
|
2480
|
+
client: { resource: "channels", method: "unmute" },
|
|
2481
|
+
capability: "channels",
|
|
2482
|
+
description: "Unmute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
2483
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
2484
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
2485
|
+
}),
|
|
2442
2486
|
channelMembers: route({
|
|
2443
2487
|
key: "channelMembers",
|
|
2444
2488
|
method: "GET",
|
|
@@ -3805,30 +3849,32 @@ Use the \`raft\` CLI for chat / task / attachment operations (\`slock\` remains
|
|
|
3805
3849
|
4. **\`raft channel members\`** \u2014 List the members (agents and humans) of a specific channel, DM, or thread target.
|
|
3806
3850
|
5. **\`raft channel join\`** \u2014 Join a visible public channel. This only affects your own agent membership.
|
|
3807
3851
|
6. **\`raft channel leave\`** \u2014 Leave a regular channel you have joined. This only affects your own agent membership.
|
|
3808
|
-
7. **\`raft
|
|
3809
|
-
8. **\`raft
|
|
3810
|
-
9. **\`raft
|
|
3811
|
-
10. **\`raft message
|
|
3812
|
-
11. **\`raft message
|
|
3813
|
-
12. **\`raft
|
|
3814
|
-
13. **\`raft
|
|
3815
|
-
14. **\`raft task
|
|
3816
|
-
15. **\`raft task
|
|
3817
|
-
16. **\`raft task
|
|
3818
|
-
17. **\`raft
|
|
3819
|
-
18. **\`raft
|
|
3820
|
-
19. **\`raft
|
|
3821
|
-
20. **\`raft
|
|
3822
|
-
21. **\`raft
|
|
3823
|
-
22. **\`raft
|
|
3824
|
-
23. **\`raft integration
|
|
3825
|
-
24. **\`raft
|
|
3826
|
-
25. **\`raft
|
|
3827
|
-
26. **\`raft reminder
|
|
3828
|
-
27. **\`raft reminder
|
|
3829
|
-
28. **\`raft reminder
|
|
3830
|
-
29. **\`raft reminder
|
|
3831
|
-
30. **\`raft
|
|
3852
|
+
7. **\`raft channel mute\`** \u2014 Mute ordinary Activity delivery for a regular channel for your agent. Personal @mentions and DMs still pierce; a task pierces only when it personally @mentions you (being a task does not pierce).
|
|
3853
|
+
8. **\`raft channel unmute\`** \u2014 Unmute ordinary Activity delivery for a regular channel for your agent. Muted-window messages are not retroactively promoted.
|
|
3854
|
+
9. **\`raft thread unfollow\`** \u2014 Stop receiving ordinary delivery for a thread you no longer need to follow. This only affects your own agent attention state.
|
|
3855
|
+
10. **\`raft message read\`** \u2014 Read past messages from a channel, DM, or thread. Supports \`before\` / \`after\` anchors and \`around\` for centered context.
|
|
3856
|
+
11. **\`raft message search\`** \u2014 Search messages visible to you, then inspect a hit with \`raft message read\`.
|
|
3857
|
+
12. **\`raft message resolve\`** \u2014 Verify that a cited message id exists exactly and print its canonical message row. Use this when checking whether a referenced id is real; \`read --around\` is for context, not proof.
|
|
3858
|
+
13. **\`raft message react\`** \u2014 Add or remove your reaction on a message. Use sparingly: prefer acknowledgement/follow-up signals like \u{1F440}, and do not auto-react to every merge, deploy, or task completion with celebratory emoji.
|
|
3859
|
+
14. **\`raft task list\`** \u2014 View a channel's task board.
|
|
3860
|
+
15. **\`raft task create\`** \u2014 Create new task-messages in a channel (supports batch titles; equivalent to sending a new message and publishing it as a task-message, not claiming it for yourself).
|
|
3861
|
+
16. **\`raft task claim\`** \u2014 Claim tasks by number or message ID using repeatable flags; examples: \`raft task claim --channel "#channel" --number 1 --number 2\`, or \`raft task claim --channel "#channel" --message-id abc12345\`.
|
|
3862
|
+
17. **\`raft task unclaim\`** \u2014 Release your claim on a task.
|
|
3863
|
+
18. **\`raft task update\`** \u2014 Change a task's status (e.g. to in_review or done).
|
|
3864
|
+
19. **\`raft attachment upload\`** \u2014 Upload a file to attach to a message. Uses content sniffing for image previews; pass \`--mime-type\` only when you know the exact type. Returns an attachment ID to pass to \`raft message send\`.
|
|
3865
|
+
20. **\`raft attachment view\`** \u2014 Download an attached file by its attachment ID so you can inspect it locally.
|
|
3866
|
+
21. **\`raft profile show\`** \u2014 Show your own profile, or another visible profile via \`@handle\`. Mirrors the canonical Slock profile view.
|
|
3867
|
+
22. **\`raft profile update\`** \u2014 Update your own profile. Supports \`--avatar-file <path>\`, \`--avatar-url pixel:random:<seed>\`, \`--display-name <name>\`, and \`--description <text>\`. Use \`--avatar-url pixel:random:<seed>\` when you want a new pixel avatar but do not have a local image file. Values must be non-empty. Provide at least one flag per call; multiple flags can be combined.
|
|
3868
|
+
23. **\`raft integration list\`** \u2014 List built-in Slock apps, registered third-party services, and this agent's active Slock Agent Logins.
|
|
3869
|
+
24. **\`raft integration login\`** \u2014 Provision or reuse this agent's login for a built-in Slock app or registered third-party service.
|
|
3870
|
+
25. **\`raft integration env\`** \u2014 Print per-agent local CLI environment for a manifest-backed service that requires isolated HOME/XDG state.
|
|
3871
|
+
26. **\`raft reminder schedule\`** \u2014 Schedule a reminder for yourself later, at a specific time, or on a recurring cadence.
|
|
3872
|
+
27. **\`raft reminder list\`** \u2014 List your reminders, including lifecycle history for each reminder.
|
|
3873
|
+
28. **\`raft reminder snooze\`** \u2014 Push a reminder later without replacing it.
|
|
3874
|
+
29. **\`raft reminder update\`** \u2014 Change a reminder's title, schedule, or recurrence without creating a new reminder.
|
|
3875
|
+
30. **\`raft reminder cancel\`** \u2014 Cancel one of your reminders by ID.
|
|
3876
|
+
31. **\`raft reminder log\`** \u2014 Show the event log for a reminder, including fires, dismissals, and reschedules.
|
|
3877
|
+
32. **\`raft action prepare\`** \u2014 Prepare an action card for a human to commit (B-mode quick-commit shortcut). Posts a card the human can click to execute the action under their own identity. Pass \`--target <ch>\` and pipe the action JSON on stdin (variants: \`channel:create\`, \`agent:create\`).
|
|
3832
3878
|
|
|
3833
3879
|
The CLI prints human-readable canonical text on success (matching the format you see in received messages and history). On failure it prints canonical labeled text to stderr:
|
|
3834
3880
|
- \`Error:\` human-readable error summary
|
|
@@ -3899,7 +3945,7 @@ function buildDiscoverySection() {
|
|
|
3899
3945
|
return `### Discovering people and channels
|
|
3900
3946
|
|
|
3901
3947
|
Call \`raft server info\` to see all channels in this server, which ones you have joined, other agents, and humans.
|
|
3902
|
-
Visible public channels may appear even when \`joined=false\`. In that state you can still inspect them with \`raft message read\` and \`raft channel members\`, but you cannot send messages there or receive ordinary channel delivery until you join with \`raft channel join --target "#channel-name"\`. Private channels require a human with access to add you. To leave a regular channel you have joined, use \`raft channel leave --target "#channel-name"\`. To stop following a thread without leaving its parent channel, use \`raft thread unfollow --target "#channel-name:shortid"\`.
|
|
3948
|
+
Visible public channels may appear even when \`joined=false\`. In that state you can still inspect them with \`raft message read\` and \`raft channel members\`, but you cannot send messages there or receive ordinary channel delivery until you join with \`raft channel join --target "#channel-name"\`. Private channels require a human with access to add you. To leave a regular channel you have joined, use \`raft channel leave --target "#channel-name"\`. To mute ordinary Activity delivery without leaving a regular channel, use \`raft channel mute "#channel-name"\`; personal @mentions and DMs still pierce (a task pierces only when it personally @mentions you), and thread following is separate. To reverse that setting, use \`raft channel unmute "#channel-name"\`. To stop following a thread without leaving its parent channel, use \`raft thread unfollow --target "#channel-name:shortid"\`.
|
|
3903
3949
|
Private channels are membership-gated. If \`raft server info\` shows a channel as private, treat its name, members, and content as private to that channel; do not disclose that information in other channels, DMs, summaries, or task reports unless a human explicitly asks within an authorized context. In \`raft channel members\`, human role labels such as owner/admin show server-level authority; no role label means ordinary member.`;
|
|
3904
3950
|
}
|
|
3905
3951
|
function buildChannelAwarenessSection() {
|
|
@@ -4363,6 +4409,19 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
|
|
|
4363
4409
|
return candidates.filter((candidate) => existsSync(candidate.path));
|
|
4364
4410
|
}
|
|
4365
4411
|
|
|
4412
|
+
// src/authEnv.ts
|
|
4413
|
+
var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
|
|
4414
|
+
var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
|
|
4415
|
+
function scrubDaemonAuthEnv(env) {
|
|
4416
|
+
delete env[DAEMON_API_KEY_ENV];
|
|
4417
|
+
return env;
|
|
4418
|
+
}
|
|
4419
|
+
function scrubDaemonChildEnv(env) {
|
|
4420
|
+
delete env[DAEMON_API_KEY_ENV];
|
|
4421
|
+
delete env[SLOCK_AGENT_TOKEN_ENV];
|
|
4422
|
+
return env;
|
|
4423
|
+
}
|
|
4424
|
+
|
|
4366
4425
|
// src/agentCredentialProxy.ts
|
|
4367
4426
|
import { randomBytes } from "crypto";
|
|
4368
4427
|
import http from "http";
|
|
@@ -5931,7 +5990,9 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
|
|
|
5931
5990
|
var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
|
|
5932
5991
|
var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
5933
5992
|
var RAW_CREDENTIAL_ENV_DENYLIST = [
|
|
5934
|
-
"
|
|
5993
|
+
"SLOCK_AGENT_TOKEN",
|
|
5994
|
+
"SLOCK_AGENT_CREDENTIAL_KEY",
|
|
5995
|
+
"SLOCK_AGENT_CREDENTIAL_KEY_FILE"
|
|
5935
5996
|
];
|
|
5936
5997
|
var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
|
|
5937
5998
|
"agent-token",
|
|
@@ -6286,7 +6347,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
6286
6347
|
SLOCK_SERVER_URL: ctx.config.serverUrl,
|
|
6287
6348
|
PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
|
|
6288
6349
|
};
|
|
6289
|
-
|
|
6350
|
+
scrubDaemonChildEnv(spawnEnv);
|
|
6290
6351
|
for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
|
|
6291
6352
|
delete spawnEnv[key];
|
|
6292
6353
|
}
|
|
@@ -6808,7 +6869,7 @@ function requiresWindowsShell(command, platform = process.platform) {
|
|
|
6808
6869
|
}
|
|
6809
6870
|
function resolveCommandOnPath(command, deps = {}) {
|
|
6810
6871
|
const platform = deps.platform ?? process.platform;
|
|
6811
|
-
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
6872
|
+
const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
|
|
6812
6873
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
6813
6874
|
const existsSyncFn = deps.existsSyncFn ?? existsSync3;
|
|
6814
6875
|
if (platform === "win32") {
|
|
@@ -6834,7 +6895,7 @@ function firstExistingPath(candidates, deps = {}) {
|
|
|
6834
6895
|
return null;
|
|
6835
6896
|
}
|
|
6836
6897
|
function readCommandVersion(command, args = [], deps = {}) {
|
|
6837
|
-
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
6898
|
+
const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
|
|
6838
6899
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
6839
6900
|
try {
|
|
6840
6901
|
const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
|
|
@@ -8918,11 +8979,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
|
|
|
8918
8979
|
return parseCursorModelsOutput(String(result.stdout || ""));
|
|
8919
8980
|
}
|
|
8920
8981
|
function buildCursorModelProbeEnv(deps = {}) {
|
|
8921
|
-
return withWindowsUserEnvironment({
|
|
8982
|
+
return scrubDaemonChildEnv(withWindowsUserEnvironment({
|
|
8922
8983
|
...deps.env ?? process.env,
|
|
8923
8984
|
FORCE_COLOR: "0",
|
|
8924
8985
|
NO_COLOR: "1"
|
|
8925
|
-
}, deps);
|
|
8986
|
+
}, deps));
|
|
8926
8987
|
}
|
|
8927
8988
|
function runCursorModelsCommand() {
|
|
8928
8989
|
return spawnSync("cursor-agent", ["models"], {
|
|
@@ -8978,7 +9039,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
|
|
|
8978
9039
|
}
|
|
8979
9040
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
|
|
8980
9041
|
const existsSyncFn = deps.existsSyncFn ?? existsSync5;
|
|
8981
|
-
const env = deps.env ?? process.env;
|
|
9042
|
+
const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
|
|
8982
9043
|
const winPath = path8.win32;
|
|
8983
9044
|
let geminiEntry = null;
|
|
8984
9045
|
try {
|
|
@@ -9115,12 +9176,15 @@ var GeminiDriver = class {
|
|
|
9115
9176
|
// src/drivers/kimi.ts
|
|
9116
9177
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9117
9178
|
import { spawn as spawn7 } from "child_process";
|
|
9118
|
-
import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
9179
|
+
import { chmodSync, existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
9119
9180
|
import os4 from "os";
|
|
9120
9181
|
import path9 from "path";
|
|
9121
9182
|
var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
|
|
9122
9183
|
var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
|
|
9123
9184
|
var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
|
|
9185
|
+
var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
|
|
9186
|
+
var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
|
|
9187
|
+
var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
|
|
9124
9188
|
function parseToolArguments(raw) {
|
|
9125
9189
|
if (typeof raw !== "string") return raw;
|
|
9126
9190
|
try {
|
|
@@ -9129,6 +9193,73 @@ function parseToolArguments(raw) {
|
|
|
9129
9193
|
return raw;
|
|
9130
9194
|
}
|
|
9131
9195
|
}
|
|
9196
|
+
function readKimiConfigSource(home = os4.homedir(), env = process.env) {
|
|
9197
|
+
const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
9198
|
+
if (inlineConfig && inlineConfig.trim()) {
|
|
9199
|
+
return {
|
|
9200
|
+
raw: inlineConfig,
|
|
9201
|
+
explicitPath: null,
|
|
9202
|
+
sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
|
|
9203
|
+
};
|
|
9204
|
+
}
|
|
9205
|
+
const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
9206
|
+
const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
|
|
9207
|
+
try {
|
|
9208
|
+
return {
|
|
9209
|
+
raw: readFileSync3(configPath, "utf8"),
|
|
9210
|
+
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
9211
|
+
sourcePath: configPath
|
|
9212
|
+
};
|
|
9213
|
+
} catch {
|
|
9214
|
+
return {
|
|
9215
|
+
raw: null,
|
|
9216
|
+
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
9217
|
+
sourcePath: configPath
|
|
9218
|
+
};
|
|
9219
|
+
}
|
|
9220
|
+
}
|
|
9221
|
+
function buildKimiSpawnEnv(env = process.env) {
|
|
9222
|
+
const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
|
|
9223
|
+
delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
9224
|
+
delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
9225
|
+
return scrubDaemonChildEnv(spawnEnv);
|
|
9226
|
+
}
|
|
9227
|
+
function buildKimiEffectiveEnv(ctx, overrideEnv) {
|
|
9228
|
+
return {
|
|
9229
|
+
...process.env,
|
|
9230
|
+
...ctx.config.envVars || {},
|
|
9231
|
+
...overrideEnv || {}
|
|
9232
|
+
};
|
|
9233
|
+
}
|
|
9234
|
+
function buildKimiLaunchOptions(ctx, opts = {}) {
|
|
9235
|
+
const env = buildKimiEffectiveEnv(ctx, opts.env);
|
|
9236
|
+
const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
|
|
9237
|
+
const args = [];
|
|
9238
|
+
let configFilePath = null;
|
|
9239
|
+
let configContent = null;
|
|
9240
|
+
if (source.explicitPath) {
|
|
9241
|
+
configFilePath = source.explicitPath;
|
|
9242
|
+
} else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
|
|
9243
|
+
configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
|
|
9244
|
+
configContent = source.raw;
|
|
9245
|
+
if (opts.writeGeneratedConfig !== false) {
|
|
9246
|
+
writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
|
|
9247
|
+
chmodSync(configFilePath, 384);
|
|
9248
|
+
}
|
|
9249
|
+
}
|
|
9250
|
+
if (configFilePath) {
|
|
9251
|
+
args.push("--config-file", configFilePath);
|
|
9252
|
+
}
|
|
9253
|
+
if (ctx.config.model && ctx.config.model !== "default") {
|
|
9254
|
+
args.push("--model", ctx.config.model);
|
|
9255
|
+
}
|
|
9256
|
+
return {
|
|
9257
|
+
args,
|
|
9258
|
+
env: buildKimiSpawnEnv(env),
|
|
9259
|
+
configFilePath,
|
|
9260
|
+
configContent
|
|
9261
|
+
};
|
|
9262
|
+
}
|
|
9132
9263
|
function resolveKimiSpawn(commandArgs, deps = {}) {
|
|
9133
9264
|
return {
|
|
9134
9265
|
command: resolveCommandOnPath("kimi", deps) ?? "kimi",
|
|
@@ -9152,7 +9283,25 @@ var KimiDriver = class {
|
|
|
9152
9283
|
};
|
|
9153
9284
|
model = {
|
|
9154
9285
|
detectedModelsVerifiedAs: "launchable",
|
|
9155
|
-
toLaunchSpec: (modelId) =>
|
|
9286
|
+
toLaunchSpec: (modelId, ctx, opts) => {
|
|
9287
|
+
if (!ctx) return { args: ["--model", modelId] };
|
|
9288
|
+
const launchCtx = {
|
|
9289
|
+
...ctx,
|
|
9290
|
+
config: {
|
|
9291
|
+
...ctx.config,
|
|
9292
|
+
model: modelId
|
|
9293
|
+
}
|
|
9294
|
+
};
|
|
9295
|
+
const launch = buildKimiLaunchOptions(launchCtx, {
|
|
9296
|
+
home: opts?.home,
|
|
9297
|
+
writeGeneratedConfig: false
|
|
9298
|
+
});
|
|
9299
|
+
return {
|
|
9300
|
+
args: launch.args,
|
|
9301
|
+
env: launch.env,
|
|
9302
|
+
configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
|
|
9303
|
+
};
|
|
9304
|
+
}
|
|
9156
9305
|
};
|
|
9157
9306
|
supportsStdinNotification = true;
|
|
9158
9307
|
busyDeliveryMode = "direct";
|
|
@@ -9176,21 +9325,23 @@ var KimiDriver = class {
|
|
|
9176
9325
|
` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
|
|
9177
9326
|
""
|
|
9178
9327
|
].join("\n"), "utf8");
|
|
9328
|
+
const launch = buildKimiLaunchOptions(ctx);
|
|
9179
9329
|
const args = [
|
|
9180
9330
|
"--wire",
|
|
9181
9331
|
"--yolo",
|
|
9182
9332
|
"--agent-file",
|
|
9183
9333
|
agentFilePath,
|
|
9184
9334
|
"--session",
|
|
9185
|
-
this.sessionId
|
|
9335
|
+
this.sessionId,
|
|
9336
|
+
...launch.args
|
|
9186
9337
|
];
|
|
9187
9338
|
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
9188
9339
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
9189
9340
|
args.push("--model", launchRuntimeFields.model);
|
|
9190
9341
|
}
|
|
9191
9342
|
const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
|
|
9192
|
-
const
|
|
9193
|
-
const proc = spawn7(
|
|
9343
|
+
const spawnTarget = resolveKimiSpawn(args);
|
|
9344
|
+
const proc = spawn7(spawnTarget.command, spawnTarget.args, {
|
|
9194
9345
|
cwd: ctx.workingDirectory,
|
|
9195
9346
|
stdio: ["pipe", "pipe", "pipe"],
|
|
9196
9347
|
env: spawnEnv,
|
|
@@ -9198,7 +9349,7 @@ var KimiDriver = class {
|
|
|
9198
9349
|
// and has an 8191-character command-line limit. Kimi's official
|
|
9199
9350
|
// installer/uv entrypoint is an executable, so launch it directly and
|
|
9200
9351
|
// keep prompts on stdin / files instead of routing through cmd.exe.
|
|
9201
|
-
shell:
|
|
9352
|
+
shell: spawnTarget.shell
|
|
9202
9353
|
});
|
|
9203
9354
|
proc.stdin?.write(JSON.stringify({
|
|
9204
9355
|
jsonrpc: "2.0",
|
|
@@ -9311,14 +9462,9 @@ var KimiDriver = class {
|
|
|
9311
9462
|
return detectKimiModels();
|
|
9312
9463
|
}
|
|
9313
9464
|
};
|
|
9314
|
-
function detectKimiModels(home = os4.homedir()) {
|
|
9315
|
-
const
|
|
9316
|
-
|
|
9317
|
-
try {
|
|
9318
|
-
raw = readFileSync3(configPath, "utf8");
|
|
9319
|
-
} catch {
|
|
9320
|
-
return null;
|
|
9321
|
-
}
|
|
9465
|
+
function detectKimiModels(home = os4.homedir(), opts = {}) {
|
|
9466
|
+
const raw = readKimiConfigSource(home, opts.env).raw;
|
|
9467
|
+
if (raw === null) return null;
|
|
9322
9468
|
const models = [];
|
|
9323
9469
|
const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
|
|
9324
9470
|
const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
|
|
@@ -9984,7 +10130,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
|
|
|
9984
10130
|
const platform = deps.platform ?? process.platform;
|
|
9985
10131
|
const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
|
|
9986
10132
|
const result = spawnSyncFn("opencode", ["models"], {
|
|
9987
|
-
env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
10133
|
+
env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
|
|
9988
10134
|
encoding: "utf8",
|
|
9989
10135
|
timeout: 5e3,
|
|
9990
10136
|
shell: platform === "win32"
|
|
@@ -14221,19 +14367,19 @@ var AgentProcessManager = class _AgentProcessManager {
|
|
|
14221
14367
|
if (input.decision !== "local_hold" && input.decision !== "syncing_hold") return;
|
|
14222
14368
|
const ap = this.agents.get(agentId);
|
|
14223
14369
|
const messageCount = input.decision === "syncing_hold" ? input.heldMessageCount ?? input.pendingCount ?? 0 : input.pendingCount ?? input.heldMessageCount ?? 0;
|
|
14224
|
-
const
|
|
14370
|
+
const activity = projectApmHeldFreshnessActivity({
|
|
14225
14371
|
producerFactId,
|
|
14226
14372
|
action: input.action,
|
|
14227
14373
|
decision: input.decision,
|
|
14228
14374
|
target: input.target,
|
|
14229
14375
|
messageCount
|
|
14230
|
-
})
|
|
14376
|
+
});
|
|
14231
14377
|
this.sendToServer({
|
|
14232
14378
|
type: "agent:activity",
|
|
14233
14379
|
agentId,
|
|
14234
|
-
activity:
|
|
14235
|
-
detail:
|
|
14236
|
-
entries:
|
|
14380
|
+
activity: activity.statusEntry.activity,
|
|
14381
|
+
detail: activity.statusEntry.detail,
|
|
14382
|
+
entries: activity.entries,
|
|
14237
14383
|
launchId: ap?.launchId || void 0,
|
|
14238
14384
|
clientSeq: ap ? this.nextActivityClientSeq(agentId) : void 0
|
|
14239
14385
|
});
|
|
@@ -19638,7 +19784,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
|
|
|
19638
19784
|
spanAttrs: ["agentId", "event_kind", "runtime"]
|
|
19639
19785
|
}
|
|
19640
19786
|
};
|
|
19641
|
-
var DAEMON_CLI_USAGE =
|
|
19787
|
+
var DAEMON_CLI_USAGE = `Usage: slock-daemon --server-url <url> (--api-key <key> or ${DAEMON_API_KEY_ENV}=<key>)`;
|
|
19642
19788
|
var RunnerCredentialMintError2 = class extends Error {
|
|
19643
19789
|
code;
|
|
19644
19790
|
retryable;
|
|
@@ -19674,9 +19820,9 @@ function runnerCredentialErrorDetail2(error) {
|
|
|
19674
19820
|
async function waitForRunnerCredentialRetry2() {
|
|
19675
19821
|
await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
|
|
19676
19822
|
}
|
|
19677
|
-
function parseDaemonCliArgs(args) {
|
|
19823
|
+
function parseDaemonCliArgs(args, env = {}) {
|
|
19678
19824
|
let serverUrl = "";
|
|
19679
|
-
let apiKey = "";
|
|
19825
|
+
let apiKey = env[DAEMON_API_KEY_ENV] ?? "";
|
|
19680
19826
|
for (let i = 0; i < args.length; i++) {
|
|
19681
19827
|
if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
|
|
19682
19828
|
if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
|
|
@@ -19713,7 +19859,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
|
|
|
19713
19859
|
}
|
|
19714
19860
|
async function runBundledSlockCli(argv) {
|
|
19715
19861
|
process.argv = [process.execPath, "slock", ...argv];
|
|
19716
|
-
await import("./dist-
|
|
19862
|
+
await import("./dist-TE3PBFBX.js");
|
|
19717
19863
|
}
|
|
19718
19864
|
function detectRuntimes(tracer = noopTracer) {
|
|
19719
19865
|
const ids = [];
|
|
@@ -20650,6 +20796,8 @@ var DaemonCore = class {
|
|
|
20650
20796
|
|
|
20651
20797
|
export {
|
|
20652
20798
|
subscribeDaemonLogs,
|
|
20799
|
+
DAEMON_API_KEY_ENV,
|
|
20800
|
+
scrubDaemonAuthEnv,
|
|
20653
20801
|
resolveWorkspaceDirectoryPath,
|
|
20654
20802
|
scanWorkspaceDirectories,
|
|
20655
20803
|
deleteWorkspaceDirectory,
|
package/dist/cli/index.js
CHANGED
|
@@ -43225,6 +43225,21 @@ var agentApiChannelMembersResponseSchema = passthroughObject({
|
|
|
43225
43225
|
role: optionalStringSchema
|
|
43226
43226
|
}))
|
|
43227
43227
|
});
|
|
43228
|
+
var agentApiChannelMuteResponseSchema = passthroughObject({
|
|
43229
|
+
activityMuted: optionalBooleanSchema,
|
|
43230
|
+
muteFromSeq: nullableNumberSchema.optional(),
|
|
43231
|
+
attention: passthroughObject({
|
|
43232
|
+
state: optionalStringSchema,
|
|
43233
|
+
ordinaryActivity: optionalStringSchema,
|
|
43234
|
+
unmuteCommand: optionalStringSchema,
|
|
43235
|
+
unmuteApi: optionalStringSchema,
|
|
43236
|
+
muteCommand: optionalStringSchema,
|
|
43237
|
+
muteApi: optionalStringSchema,
|
|
43238
|
+
stillArrives: optionalStringArraySchema,
|
|
43239
|
+
threadBoundary: optionalStringSchema,
|
|
43240
|
+
catchUp: optionalStringSchema
|
|
43241
|
+
}).optional()
|
|
43242
|
+
});
|
|
43228
43243
|
var agentApiTaskClaimResultSchema = passthroughObject({
|
|
43229
43244
|
taskNumber: external_exports.number().int().positive().optional(),
|
|
43230
43245
|
messageId: optionalStringSchema,
|
|
@@ -43407,6 +43422,26 @@ var agentApiContract = {
|
|
|
43407
43422
|
request: { params: agentApiChannelMembershipParamsSchema },
|
|
43408
43423
|
response: { body: agentApiOkResponseSchema }
|
|
43409
43424
|
}),
|
|
43425
|
+
channelMute: route({
|
|
43426
|
+
key: "channelMute",
|
|
43427
|
+
method: "POST",
|
|
43428
|
+
path: "/channels/:channelId/mute",
|
|
43429
|
+
client: { resource: "channels", method: "mute" },
|
|
43430
|
+
capability: "channels",
|
|
43431
|
+
description: "Mute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
43432
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
43433
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
43434
|
+
}),
|
|
43435
|
+
channelUnmute: route({
|
|
43436
|
+
key: "channelUnmute",
|
|
43437
|
+
method: "POST",
|
|
43438
|
+
path: "/channels/:channelId/unmute",
|
|
43439
|
+
client: { resource: "channels", method: "unmute" },
|
|
43440
|
+
capability: "channels",
|
|
43441
|
+
description: "Unmute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
43442
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
43443
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
43444
|
+
}),
|
|
43410
43445
|
channelMembers: route({
|
|
43411
43446
|
key: "channelMembers",
|
|
43412
43447
|
method: "GET",
|
|
@@ -43648,9 +43683,6 @@ var agentApiContract = {
|
|
|
43648
43683
|
response: { body: agentApiAttachmentUploadResponseSchema }
|
|
43649
43684
|
})
|
|
43650
43685
|
};
|
|
43651
|
-
function buildLegacyAgentApiPath(agentId, routePath) {
|
|
43652
|
-
return `/internal/agent/${encodeURIComponent(agentId)}${routePath}`;
|
|
43653
|
-
}
|
|
43654
43686
|
function parseAgentApiResponse(key, value) {
|
|
43655
43687
|
return agentApiContract[key].response.body.parse(value);
|
|
43656
43688
|
}
|
|
@@ -44181,6 +44213,9 @@ init_esm_shims();
|
|
|
44181
44213
|
// ../shared/src/agentScopes.ts
|
|
44182
44214
|
init_esm_shims();
|
|
44183
44215
|
|
|
44216
|
+
// ../shared/src/docs/crossPageInvariants.ts
|
|
44217
|
+
init_esm_shims();
|
|
44218
|
+
|
|
44184
44219
|
// ../shared/src/testing/failpoints.ts
|
|
44185
44220
|
init_esm_shims();
|
|
44186
44221
|
var NoopFailpointRegistry = class {
|
|
@@ -44615,39 +44650,18 @@ async function requestMultipartContractAgentApiRoute(client, routeKey, form) {
|
|
|
44615
44650
|
});
|
|
44616
44651
|
}
|
|
44617
44652
|
}
|
|
44618
|
-
function
|
|
44619
|
-
const agentApi = createAgentApiClient(rawTransportForClient(client)
|
|
44620
|
-
pathPrefix: buildLegacyAgentApiPath(agentId, "")
|
|
44621
|
-
});
|
|
44653
|
+
function createAgentApiSurfaceClient(client) {
|
|
44654
|
+
const agentApi = createAgentApiClient(rawTransportForClient(client));
|
|
44622
44655
|
return {
|
|
44623
44656
|
server: {
|
|
44624
44657
|
info: () => requestClientAsApiResponse(agentApi.server.info())
|
|
44625
44658
|
},
|
|
44626
|
-
history: {
|
|
44627
|
-
read: (query) => requestClientAsApiResponse(agentApi.history.read(query))
|
|
44628
|
-
},
|
|
44629
|
-
messages: {
|
|
44630
|
-
send: (body) => requestClientAsApiResponse(agentApi.messages.send(body)),
|
|
44631
|
-
resolve: (params) => requestClientAsApiResponse(agentApi.messages.resolve(params)),
|
|
44632
|
-
addReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.addReaction(params, body)),
|
|
44633
|
-
removeReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.removeReaction(params, body))
|
|
44634
|
-
},
|
|
44635
|
-
channels: {
|
|
44636
|
-
join: (params) => requestClientAsApiResponse(agentApi.channels.join(params)),
|
|
44637
|
-
leave: (params) => requestClientAsApiResponse(agentApi.channels.leave(params))
|
|
44638
|
-
},
|
|
44639
|
-
mentions: {
|
|
44640
|
-
pendingActions: (query) => requestClientAsApiResponse(agentApi.mentions.pendingActions(query ?? {})),
|
|
44641
|
-
executeAction: (body) => requestClientAsApiResponse(agentApi.mentions.executeAction(body))
|
|
44642
|
-
}
|
|
44643
|
-
};
|
|
44644
|
-
}
|
|
44645
|
-
function createAgentApiSurfaceClient(client) {
|
|
44646
|
-
const agentApi = createAgentApiClient(rawTransportForClient(client));
|
|
44647
|
-
return {
|
|
44648
44659
|
events: {
|
|
44649
44660
|
get: (query) => requestClientAsApiResponse(agentApi.events.get(query))
|
|
44650
44661
|
},
|
|
44662
|
+
history: {
|
|
44663
|
+
read: (query) => requestClientAsApiResponse(agentApi.history.read(query))
|
|
44664
|
+
},
|
|
44651
44665
|
tasks: {
|
|
44652
44666
|
list: (query) => requestClientAsApiResponse(agentApi.tasks.list(query)),
|
|
44653
44667
|
create: (body) => requestClientAsApiResponse(agentApi.tasks.create(body)),
|
|
@@ -44664,9 +44678,17 @@ function createAgentApiSurfaceClient(client) {
|
|
|
44664
44678
|
log: (params) => requestClientAsApiResponse(agentApi.reminders.log(params))
|
|
44665
44679
|
},
|
|
44666
44680
|
messages: {
|
|
44667
|
-
|
|
44681
|
+
send: (body) => requestClientAsApiResponse(agentApi.messages.send(body)),
|
|
44682
|
+
resolve: (params) => requestClientAsApiResponse(agentApi.messages.resolve(params)),
|
|
44683
|
+
search: (query) => requestClientAsApiResponse(agentApi.messages.search(query)),
|
|
44684
|
+
addReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.addReaction(params, body)),
|
|
44685
|
+
removeReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.removeReaction(params, body))
|
|
44668
44686
|
},
|
|
44669
44687
|
channels: {
|
|
44688
|
+
join: (params) => requestClientAsApiResponse(agentApi.channels.join(params)),
|
|
44689
|
+
leave: (params) => requestClientAsApiResponse(agentApi.channels.leave(params)),
|
|
44690
|
+
mute: (params) => requestClientAsApiResponse(agentApi.channels.mute(params)),
|
|
44691
|
+
unmute: (params) => requestClientAsApiResponse(agentApi.channels.unmute(params)),
|
|
44670
44692
|
members: (query) => requestClientAsApiResponse(agentApi.channels.members(query)),
|
|
44671
44693
|
resolve: (body) => requestClientAsApiResponse(agentApi.channels.resolve(body))
|
|
44672
44694
|
},
|
|
@@ -44685,6 +44707,10 @@ function createAgentApiSurfaceClient(client) {
|
|
|
44685
44707
|
actions: {
|
|
44686
44708
|
prepare: (body) => requestClientAsApiResponse(agentApi.actions.prepare(body))
|
|
44687
44709
|
},
|
|
44710
|
+
mentions: {
|
|
44711
|
+
pendingActions: (query) => requestClientAsApiResponse(agentApi.mentions.pendingActions(query ?? {})),
|
|
44712
|
+
executeAction: (body) => requestClientAsApiResponse(agentApi.mentions.executeAction(body))
|
|
44713
|
+
},
|
|
44688
44714
|
attachments: {
|
|
44689
44715
|
upload: (form) => requestMultipartContractAgentApiRoute(client, "attachmentUpload", form)
|
|
44690
44716
|
}
|
|
@@ -44950,7 +44976,7 @@ var ApiClient = class {
|
|
|
44950
44976
|
if (reaction) {
|
|
44951
44977
|
return `/internal/agent-api/messages/${reaction[1]}/reactions`;
|
|
44952
44978
|
}
|
|
44953
|
-
const channelMembership = /^\/channels\/([^/]+)\/(join|leave)$/.exec(suffix);
|
|
44979
|
+
const channelMembership = /^\/channels\/([^/]+)\/(join|leave|mute|unmute)$/.exec(suffix);
|
|
44954
44980
|
if (channelMembership) {
|
|
44955
44981
|
return `/internal/agent-api/channels/${channelMembership[1]}/${channelMembership[2]}`;
|
|
44956
44982
|
}
|
|
@@ -47738,7 +47764,8 @@ var channelLeaveCommand = defineCommand(
|
|
|
47738
47764
|
}
|
|
47739
47765
|
const agentContext = ctx.loadAgentContext();
|
|
47740
47766
|
const client = ctx.createApiClient(agentContext);
|
|
47741
|
-
const
|
|
47767
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47768
|
+
const infoRes = await agentApi.server.info();
|
|
47742
47769
|
if (!infoRes.ok) {
|
|
47743
47770
|
throw new CliError({
|
|
47744
47771
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47756,7 +47783,7 @@ var channelLeaveCommand = defineCommand(
|
|
|
47756
47783
|
writeText(ctx.io, formatAlreadyNotJoined(target) + "\n");
|
|
47757
47784
|
return;
|
|
47758
47785
|
}
|
|
47759
|
-
const leaveRes = await
|
|
47786
|
+
const leaveRes = await agentApi.channels.leave({
|
|
47760
47787
|
channelId: channel.id
|
|
47761
47788
|
});
|
|
47762
47789
|
if (!leaveRes.ok) {
|
|
@@ -47801,7 +47828,8 @@ var channelJoinCommand = defineCommand(
|
|
|
47801
47828
|
}
|
|
47802
47829
|
const agentContext = ctx.loadAgentContext();
|
|
47803
47830
|
const client = ctx.createApiClient(agentContext);
|
|
47804
|
-
const
|
|
47831
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47832
|
+
const infoRes = await agentApi.server.info();
|
|
47805
47833
|
if (!infoRes.ok) {
|
|
47806
47834
|
throw new CliError({
|
|
47807
47835
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47819,7 +47847,7 @@ var channelJoinCommand = defineCommand(
|
|
|
47819
47847
|
writeText(ctx.io, formatAlreadyJoined(target) + "\n");
|
|
47820
47848
|
return;
|
|
47821
47849
|
}
|
|
47822
|
-
const joinRes = await
|
|
47850
|
+
const joinRes = await agentApi.channels.join({
|
|
47823
47851
|
channelId: channel.id
|
|
47824
47852
|
});
|
|
47825
47853
|
if (!joinRes.ok) {
|
|
@@ -47835,6 +47863,84 @@ function registerChannelJoinCommand(parent, runtimeOptions) {
|
|
|
47835
47863
|
registerCliCommand(parent, channelJoinCommand, runtimeOptions);
|
|
47836
47864
|
}
|
|
47837
47865
|
|
|
47866
|
+
// src/commands/channel/mute.ts
|
|
47867
|
+
init_esm_shims();
|
|
47868
|
+
function formatSeq(value) {
|
|
47869
|
+
return value == null ? "none" : String(value);
|
|
47870
|
+
}
|
|
47871
|
+
function formatChannelMuteResult(target, result2) {
|
|
47872
|
+
const lines = [
|
|
47873
|
+
`${result2.activityMuted ? "Muted" : "Unmuted"} ${target}.`,
|
|
47874
|
+
`Activity muted: ${result2.activityMuted ? "yes" : "no"}`,
|
|
47875
|
+
`Mute from seq: ${formatSeq(result2.muteFromSeq)}`
|
|
47876
|
+
];
|
|
47877
|
+
if (result2.attention?.ordinaryActivity) lines.push(result2.attention.ordinaryActivity);
|
|
47878
|
+
if (result2.attention?.stillArrives?.length) {
|
|
47879
|
+
lines.push("Still arrives:");
|
|
47880
|
+
for (const item of result2.attention.stillArrives) lines.push(`- ${item}`);
|
|
47881
|
+
}
|
|
47882
|
+
if (result2.attention?.threadBoundary) lines.push(result2.attention.threadBoundary);
|
|
47883
|
+
if (result2.attention?.catchUp) lines.push(result2.attention.catchUp);
|
|
47884
|
+
if (result2.attention?.unmuteCommand) lines.push(`To unmute: ${result2.attention.unmuteCommand}`);
|
|
47885
|
+
if (result2.attention?.unmuteApi) lines.push(`Agent API: ${result2.attention.unmuteApi}`);
|
|
47886
|
+
if (result2.attention?.muteCommand) lines.push(`To mute: ${result2.attention.muteCommand}`);
|
|
47887
|
+
if (result2.attention?.muteApi) lines.push(`Agent API: ${result2.attention.muteApi}`);
|
|
47888
|
+
return lines.join("\n");
|
|
47889
|
+
}
|
|
47890
|
+
function makeChannelMuteCommand(action) {
|
|
47891
|
+
return defineCommand(
|
|
47892
|
+
{
|
|
47893
|
+
name: action,
|
|
47894
|
+
description: action === "mute" ? "Mute ordinary Activity delivery for a regular channel" : "Unmute ordinary Activity delivery for a regular channel",
|
|
47895
|
+
arguments: ["<target>"]
|
|
47896
|
+
},
|
|
47897
|
+
async (ctx, targetArg) => {
|
|
47898
|
+
const target = String(targetArg ?? "");
|
|
47899
|
+
const channelName = parseRegularChannelTarget(target);
|
|
47900
|
+
if (!channelName) {
|
|
47901
|
+
throw new CliError({
|
|
47902
|
+
code: "INVALID_TARGET",
|
|
47903
|
+
message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
|
|
47904
|
+
});
|
|
47905
|
+
}
|
|
47906
|
+
const agentContext = ctx.loadAgentContext();
|
|
47907
|
+
const client = ctx.createApiClient(agentContext);
|
|
47908
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47909
|
+
const infoRes = await agentApi.server.info();
|
|
47910
|
+
if (!infoRes.ok) {
|
|
47911
|
+
throw new CliError({
|
|
47912
|
+
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
47913
|
+
message: infoRes.error ?? `HTTP ${infoRes.status}`
|
|
47914
|
+
});
|
|
47915
|
+
}
|
|
47916
|
+
const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
|
|
47917
|
+
if (!channel) {
|
|
47918
|
+
throw new CliError({
|
|
47919
|
+
code: "NOT_FOUND",
|
|
47920
|
+
message: `Channel not found: ${target}`
|
|
47921
|
+
});
|
|
47922
|
+
}
|
|
47923
|
+
const res = action === "mute" ? await agentApi.channels.mute({ channelId: channel.id }) : await agentApi.channels.unmute({ channelId: channel.id });
|
|
47924
|
+
if (!res.ok) {
|
|
47925
|
+
throw new CliError({
|
|
47926
|
+
code: res.status >= 500 ? "SERVER_5XX" : action === "mute" ? "MUTE_FAILED" : "UNMUTE_FAILED",
|
|
47927
|
+
message: res.error ?? `HTTP ${res.status}`,
|
|
47928
|
+
suggestedNextAction: res.suggestedNextAction ?? void 0
|
|
47929
|
+
});
|
|
47930
|
+
}
|
|
47931
|
+
writeText(ctx.io, formatChannelMuteResult(target, res.data ?? {}) + "\n");
|
|
47932
|
+
}
|
|
47933
|
+
);
|
|
47934
|
+
}
|
|
47935
|
+
var channelMuteCommand = makeChannelMuteCommand("mute");
|
|
47936
|
+
var channelUnmuteCommand = makeChannelMuteCommand("unmute");
|
|
47937
|
+
function registerChannelMuteCommand(parent, runtimeOptions) {
|
|
47938
|
+
registerCliCommand(parent, channelMuteCommand, runtimeOptions);
|
|
47939
|
+
}
|
|
47940
|
+
function registerChannelUnmuteCommand(parent, runtimeOptions) {
|
|
47941
|
+
registerCliCommand(parent, channelUnmuteCommand, runtimeOptions);
|
|
47942
|
+
}
|
|
47943
|
+
|
|
47838
47944
|
// src/commands/server/info.ts
|
|
47839
47945
|
init_esm_shims();
|
|
47840
47946
|
var serverInfoCommand = defineCommand(
|
|
@@ -47845,7 +47951,7 @@ var serverInfoCommand = defineCommand(
|
|
|
47845
47951
|
async (ctx) => {
|
|
47846
47952
|
const agentContext = ctx.loadAgentContext();
|
|
47847
47953
|
const client = ctx.createApiClient(agentContext);
|
|
47848
|
-
const res = await
|
|
47954
|
+
const res = await createAgentApiSurfaceClient(client).server.info();
|
|
47849
47955
|
if (!res.ok) {
|
|
47850
47956
|
const code = res.status >= 500 ? "SERVER_5XX" : "INFO_FAILED";
|
|
47851
47957
|
throw new CliError({
|
|
@@ -47869,13 +47975,13 @@ function registerServerInfoCommand(parent, runtimeOptions) {
|
|
|
47869
47975
|
|
|
47870
47976
|
// src/commands/knowledge/get.ts
|
|
47871
47977
|
init_esm_shims();
|
|
47872
|
-
function buildKnowledgeGetPath(
|
|
47978
|
+
function buildKnowledgeGetPath(topic, opts) {
|
|
47873
47979
|
const params = new URLSearchParams();
|
|
47874
47980
|
params.set("topic", topic);
|
|
47875
47981
|
if (opts.reason) params.set("reason", opts.reason);
|
|
47876
47982
|
if (opts.turnId) params.set("turn_id", opts.turnId);
|
|
47877
47983
|
if (opts.traceId) params.set("trace_id", opts.traceId);
|
|
47878
|
-
return `/internal/agent
|
|
47984
|
+
return `/internal/agent-api/knowledge?${params.toString()}`;
|
|
47879
47985
|
}
|
|
47880
47986
|
function formatKnowledgeStdout(content) {
|
|
47881
47987
|
return content.endsWith("\n") ? content : `${content}
|
|
@@ -47925,7 +48031,7 @@ var knowledgeGetCommand = defineCommand(
|
|
|
47925
48031
|
const client = ctx.createApiClient(agentContext);
|
|
47926
48032
|
const res = await client.request(
|
|
47927
48033
|
"GET",
|
|
47928
|
-
buildKnowledgeGetPath(
|
|
48034
|
+
buildKnowledgeGetPath(topic, opts)
|
|
47929
48035
|
);
|
|
47930
48036
|
if (!res.ok) {
|
|
47931
48037
|
throw new CliError({
|
|
@@ -48744,7 +48850,7 @@ var messageSendCommand = defineCommand(
|
|
|
48744
48850
|
if (outgoingAttachmentIds.length > 0) {
|
|
48745
48851
|
body.attachmentIds = outgoingAttachmentIds;
|
|
48746
48852
|
}
|
|
48747
|
-
const agentApi =
|
|
48853
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48748
48854
|
const res = await agentApi.messages.send(body);
|
|
48749
48855
|
if (!res.ok) {
|
|
48750
48856
|
const code = res.status >= 500 ? "SERVER_5XX" : "SEND_FAILED";
|
|
@@ -48982,7 +49088,7 @@ var messageReadCommand = defineCommand(
|
|
|
48982
49088
|
const readOpts = validateReadOpts(opts);
|
|
48983
49089
|
const agentContext = ctx.loadAgentContext();
|
|
48984
49090
|
const client = ctx.createApiClient(agentContext);
|
|
48985
|
-
const agentApi =
|
|
49091
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48986
49092
|
const res = await agentApi.history.read({
|
|
48987
49093
|
channel: readOpts.channel,
|
|
48988
49094
|
...readOpts.before !== void 0 ? { before: readOpts.before } : {},
|
|
@@ -49175,7 +49281,7 @@ var messageResolveCommand = defineCommand(
|
|
|
49175
49281
|
}
|
|
49176
49282
|
const agentContext = ctx.loadAgentContext();
|
|
49177
49283
|
const client = ctx.createApiClient(agentContext);
|
|
49178
|
-
const res = await
|
|
49284
|
+
const res = await createAgentApiSurfaceClient(client).messages.resolve({ msgId: asMessageId(id) });
|
|
49179
49285
|
if (!res.ok) {
|
|
49180
49286
|
const mapped = mapResolveError(res);
|
|
49181
49287
|
throw new CliError(mapped);
|
|
@@ -49234,7 +49340,7 @@ var messageReactCommand = defineCommand(
|
|
|
49234
49340
|
}
|
|
49235
49341
|
const agentContext = ctx.loadAgentContext();
|
|
49236
49342
|
const client = ctx.createApiClient(agentContext);
|
|
49237
|
-
const agentApi =
|
|
49343
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
49238
49344
|
const messageId = asMessageId(opts.messageId.trim());
|
|
49239
49345
|
const res = opts.remove ? await agentApi.messages.removeReaction({ msgId: messageId }, { emoji: emoji3 }) : await agentApi.messages.addReaction({ msgId: messageId }, { emoji: emoji3 });
|
|
49240
49346
|
if (!res.ok) {
|
|
@@ -49931,7 +50037,7 @@ function buildMentionExecuteCommand(action) {
|
|
|
49931
50037
|
const ids = normalizeResolutionIds(resolutionIds);
|
|
49932
50038
|
const agentContext = ctx.loadAgentContext();
|
|
49933
50039
|
const client = ctx.createApiClient(agentContext);
|
|
49934
|
-
const res = await
|
|
50040
|
+
const res = await createAgentApiSurfaceClient(client).mentions.executeAction({
|
|
49935
50041
|
action,
|
|
49936
50042
|
resolutionIds: ids
|
|
49937
50043
|
});
|
|
@@ -49963,7 +50069,7 @@ var mentionPendingCommand = defineCommand(
|
|
|
49963
50069
|
async (ctx, opts = {}) => {
|
|
49964
50070
|
const agentContext = ctx.loadAgentContext();
|
|
49965
50071
|
const client = ctx.createApiClient(agentContext);
|
|
49966
|
-
const res = await
|
|
50072
|
+
const res = await createAgentApiSurfaceClient(client).mentions.pendingActions();
|
|
49967
50073
|
if (!res.ok || !res.data) {
|
|
49968
50074
|
throw cliError(res.status >= 500 ? "SERVER_5XX" : "MENTION_PENDING_FAILED", res.error ?? `HTTP ${res.status}`);
|
|
49969
50075
|
}
|
|
@@ -50610,9 +50716,15 @@ function sanitizePathSegment(value) {
|
|
|
50610
50716
|
const segment = value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
50611
50717
|
return segment || "service";
|
|
50612
50718
|
}
|
|
50613
|
-
function resolveSlockHome(env) {
|
|
50614
|
-
|
|
50615
|
-
|
|
50719
|
+
function resolveSlockHome(env, homeDir = os4.homedir()) {
|
|
50720
|
+
const configured = env.SLOCK_HOME?.trim() || env.RAFT_HOME?.trim();
|
|
50721
|
+
const raw = configured && configured.length > 0 ? configured : path8.join(homeDir, ".slock");
|
|
50722
|
+
return path8.resolve(expandHome(raw, homeDir));
|
|
50723
|
+
}
|
|
50724
|
+
function expandHome(input, homeDir) {
|
|
50725
|
+
if (input === "~") return homeDir;
|
|
50726
|
+
if (input.startsWith("~/")) return path8.join(homeDir, input.slice(2));
|
|
50727
|
+
return input;
|
|
50616
50728
|
}
|
|
50617
50729
|
function buildLocalCliProfileEnv(input) {
|
|
50618
50730
|
if (input.manifest.execution.mode !== "local_cli" || !input.manifest.execution.command) {
|
|
@@ -50624,7 +50736,7 @@ function buildLocalCliProfileEnv(input) {
|
|
|
50624
50736
|
if (input.manifest.credential_boundary.forbid_user_home !== true) {
|
|
50625
50737
|
throw new Error("manifest must set credential_boundary.forbid_user_home=true for local_cli isolation");
|
|
50626
50738
|
}
|
|
50627
|
-
const root = resolveSlockHome(input.env ?? process.env);
|
|
50739
|
+
const root = resolveSlockHome(input.env ?? process.env, input.homeDir);
|
|
50628
50740
|
const profileHome = path8.join(
|
|
50629
50741
|
root,
|
|
50630
50742
|
"integration-profiles",
|
|
@@ -51384,10 +51496,12 @@ var agentCmd = program2.command("agent").description("External agent onboarding
|
|
|
51384
51496
|
registerAgentLoginCommand(agentCmd);
|
|
51385
51497
|
registerAgentListCommand(agentCmd);
|
|
51386
51498
|
registerAgentBridgeCommand(agentCmd);
|
|
51387
|
-
var channelCmd = program2.command("channel").description("Channel membership operations");
|
|
51499
|
+
var channelCmd = program2.command("channel").description("Channel membership and attention operations");
|
|
51388
51500
|
registerChannelMembersCommand(channelCmd);
|
|
51389
51501
|
registerChannelJoinCommand(channelCmd);
|
|
51390
51502
|
registerChannelLeaveCommand(channelCmd);
|
|
51503
|
+
registerChannelMuteCommand(channelCmd);
|
|
51504
|
+
registerChannelUnmuteCommand(channelCmd);
|
|
51391
51505
|
var threadCmd = program2.command("thread").description("Thread attention operations");
|
|
51392
51506
|
registerThreadUnfollowCommand(threadCmd);
|
|
51393
51507
|
var serverCmd = program2.command("server").description("Server / workspace introspection");
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DAEMON_API_KEY_ENV,
|
|
2
3
|
DAEMON_CLI_USAGE,
|
|
3
4
|
DAEMON_CORE_TRACE_ATTR_CONTRACTS,
|
|
4
5
|
DaemonCore,
|
|
@@ -11,9 +12,11 @@ import {
|
|
|
11
12
|
resolveWorkspaceDirectoryPath,
|
|
12
13
|
runBundledSlockCli,
|
|
13
14
|
scanWorkspaceDirectories,
|
|
15
|
+
scrubDaemonAuthEnv,
|
|
14
16
|
subscribeDaemonLogs
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YAQHU63I.js";
|
|
16
18
|
export {
|
|
19
|
+
DAEMON_API_KEY_ENV,
|
|
17
20
|
DAEMON_CLI_USAGE,
|
|
18
21
|
DAEMON_CORE_TRACE_ATTR_CONTRACTS,
|
|
19
22
|
DaemonCore,
|
|
@@ -26,5 +29,6 @@ export {
|
|
|
26
29
|
resolveWorkspaceDirectoryPath,
|
|
27
30
|
runBundledSlockCli,
|
|
28
31
|
scanWorkspaceDirectories,
|
|
32
|
+
scrubDaemonAuthEnv,
|
|
29
33
|
subscribeDaemonLogs
|
|
30
34
|
};
|
|
@@ -42781,6 +42781,21 @@ var agentApiChannelMembersResponseSchema = passthroughObject({
|
|
|
42781
42781
|
role: optionalStringSchema
|
|
42782
42782
|
}))
|
|
42783
42783
|
});
|
|
42784
|
+
var agentApiChannelMuteResponseSchema = passthroughObject({
|
|
42785
|
+
activityMuted: optionalBooleanSchema,
|
|
42786
|
+
muteFromSeq: nullableNumberSchema.optional(),
|
|
42787
|
+
attention: passthroughObject({
|
|
42788
|
+
state: optionalStringSchema,
|
|
42789
|
+
ordinaryActivity: optionalStringSchema,
|
|
42790
|
+
unmuteCommand: optionalStringSchema,
|
|
42791
|
+
unmuteApi: optionalStringSchema,
|
|
42792
|
+
muteCommand: optionalStringSchema,
|
|
42793
|
+
muteApi: optionalStringSchema,
|
|
42794
|
+
stillArrives: optionalStringArraySchema,
|
|
42795
|
+
threadBoundary: optionalStringSchema,
|
|
42796
|
+
catchUp: optionalStringSchema
|
|
42797
|
+
}).optional()
|
|
42798
|
+
});
|
|
42784
42799
|
var agentApiTaskClaimResultSchema = passthroughObject({
|
|
42785
42800
|
taskNumber: external_exports.number().int().positive().optional(),
|
|
42786
42801
|
messageId: optionalStringSchema,
|
|
@@ -42963,6 +42978,26 @@ var agentApiContract = {
|
|
|
42963
42978
|
request: { params: agentApiChannelMembershipParamsSchema },
|
|
42964
42979
|
response: { body: agentApiOkResponseSchema }
|
|
42965
42980
|
}),
|
|
42981
|
+
channelMute: route({
|
|
42982
|
+
key: "channelMute",
|
|
42983
|
+
method: "POST",
|
|
42984
|
+
path: "/channels/:channelId/mute",
|
|
42985
|
+
client: { resource: "channels", method: "mute" },
|
|
42986
|
+
capability: "channels",
|
|
42987
|
+
description: "Mute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
42988
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
42989
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
42990
|
+
}),
|
|
42991
|
+
channelUnmute: route({
|
|
42992
|
+
key: "channelUnmute",
|
|
42993
|
+
method: "POST",
|
|
42994
|
+
path: "/channels/:channelId/unmute",
|
|
42995
|
+
client: { resource: "channels", method: "unmute" },
|
|
42996
|
+
capability: "channels",
|
|
42997
|
+
description: "Unmute ordinary activity delivery for a visible regular channel as the bound agent credential.",
|
|
42998
|
+
request: { params: agentApiChannelMembershipParamsSchema },
|
|
42999
|
+
response: { body: agentApiChannelMuteResponseSchema }
|
|
43000
|
+
}),
|
|
42966
43001
|
channelMembers: route({
|
|
42967
43002
|
key: "channelMembers",
|
|
42968
43003
|
method: "GET",
|
|
@@ -43204,9 +43239,6 @@ var agentApiContract = {
|
|
|
43204
43239
|
response: { body: agentApiAttachmentUploadResponseSchema }
|
|
43205
43240
|
})
|
|
43206
43241
|
};
|
|
43207
|
-
function buildLegacyAgentApiPath(agentId, routePath) {
|
|
43208
|
-
return `/internal/agent/${encodeURIComponent(agentId)}${routePath}`;
|
|
43209
|
-
}
|
|
43210
43242
|
function parseAgentApiResponse(key, value) {
|
|
43211
43243
|
return agentApiContract[key].response.body.parse(value);
|
|
43212
43244
|
}
|
|
@@ -43721,6 +43753,7 @@ init_esm_shims();
|
|
|
43721
43753
|
init_esm_shims();
|
|
43722
43754
|
init_esm_shims();
|
|
43723
43755
|
init_esm_shims();
|
|
43756
|
+
init_esm_shims();
|
|
43724
43757
|
var NoopFailpointRegistry = class {
|
|
43725
43758
|
get enabled() {
|
|
43726
43759
|
return false;
|
|
@@ -44147,39 +44180,18 @@ async function requestMultipartContractAgentApiRoute(client, routeKey, form) {
|
|
|
44147
44180
|
});
|
|
44148
44181
|
}
|
|
44149
44182
|
}
|
|
44150
|
-
function
|
|
44151
|
-
const agentApi = createAgentApiClient(rawTransportForClient(client)
|
|
44152
|
-
pathPrefix: buildLegacyAgentApiPath(agentId, "")
|
|
44153
|
-
});
|
|
44183
|
+
function createAgentApiSurfaceClient(client) {
|
|
44184
|
+
const agentApi = createAgentApiClient(rawTransportForClient(client));
|
|
44154
44185
|
return {
|
|
44155
44186
|
server: {
|
|
44156
44187
|
info: () => requestClientAsApiResponse(agentApi.server.info())
|
|
44157
44188
|
},
|
|
44158
|
-
history: {
|
|
44159
|
-
read: (query) => requestClientAsApiResponse(agentApi.history.read(query))
|
|
44160
|
-
},
|
|
44161
|
-
messages: {
|
|
44162
|
-
send: (body) => requestClientAsApiResponse(agentApi.messages.send(body)),
|
|
44163
|
-
resolve: (params) => requestClientAsApiResponse(agentApi.messages.resolve(params)),
|
|
44164
|
-
addReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.addReaction(params, body)),
|
|
44165
|
-
removeReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.removeReaction(params, body))
|
|
44166
|
-
},
|
|
44167
|
-
channels: {
|
|
44168
|
-
join: (params) => requestClientAsApiResponse(agentApi.channels.join(params)),
|
|
44169
|
-
leave: (params) => requestClientAsApiResponse(agentApi.channels.leave(params))
|
|
44170
|
-
},
|
|
44171
|
-
mentions: {
|
|
44172
|
-
pendingActions: (query) => requestClientAsApiResponse(agentApi.mentions.pendingActions(query ?? {})),
|
|
44173
|
-
executeAction: (body) => requestClientAsApiResponse(agentApi.mentions.executeAction(body))
|
|
44174
|
-
}
|
|
44175
|
-
};
|
|
44176
|
-
}
|
|
44177
|
-
function createAgentApiSurfaceClient(client) {
|
|
44178
|
-
const agentApi = createAgentApiClient(rawTransportForClient(client));
|
|
44179
|
-
return {
|
|
44180
44189
|
events: {
|
|
44181
44190
|
get: (query) => requestClientAsApiResponse(agentApi.events.get(query))
|
|
44182
44191
|
},
|
|
44192
|
+
history: {
|
|
44193
|
+
read: (query) => requestClientAsApiResponse(agentApi.history.read(query))
|
|
44194
|
+
},
|
|
44183
44195
|
tasks: {
|
|
44184
44196
|
list: (query) => requestClientAsApiResponse(agentApi.tasks.list(query)),
|
|
44185
44197
|
create: (body) => requestClientAsApiResponse(agentApi.tasks.create(body)),
|
|
@@ -44196,9 +44208,17 @@ function createAgentApiSurfaceClient(client) {
|
|
|
44196
44208
|
log: (params) => requestClientAsApiResponse(agentApi.reminders.log(params))
|
|
44197
44209
|
},
|
|
44198
44210
|
messages: {
|
|
44199
|
-
|
|
44211
|
+
send: (body) => requestClientAsApiResponse(agentApi.messages.send(body)),
|
|
44212
|
+
resolve: (params) => requestClientAsApiResponse(agentApi.messages.resolve(params)),
|
|
44213
|
+
search: (query) => requestClientAsApiResponse(agentApi.messages.search(query)),
|
|
44214
|
+
addReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.addReaction(params, body)),
|
|
44215
|
+
removeReaction: (params, body) => requestClientAsApiResponse(agentApi.messages.removeReaction(params, body))
|
|
44200
44216
|
},
|
|
44201
44217
|
channels: {
|
|
44218
|
+
join: (params) => requestClientAsApiResponse(agentApi.channels.join(params)),
|
|
44219
|
+
leave: (params) => requestClientAsApiResponse(agentApi.channels.leave(params)),
|
|
44220
|
+
mute: (params) => requestClientAsApiResponse(agentApi.channels.mute(params)),
|
|
44221
|
+
unmute: (params) => requestClientAsApiResponse(agentApi.channels.unmute(params)),
|
|
44202
44222
|
members: (query) => requestClientAsApiResponse(agentApi.channels.members(query)),
|
|
44203
44223
|
resolve: (body) => requestClientAsApiResponse(agentApi.channels.resolve(body))
|
|
44204
44224
|
},
|
|
@@ -44217,6 +44237,10 @@ function createAgentApiSurfaceClient(client) {
|
|
|
44217
44237
|
actions: {
|
|
44218
44238
|
prepare: (body) => requestClientAsApiResponse(agentApi.actions.prepare(body))
|
|
44219
44239
|
},
|
|
44240
|
+
mentions: {
|
|
44241
|
+
pendingActions: (query) => requestClientAsApiResponse(agentApi.mentions.pendingActions(query ?? {})),
|
|
44242
|
+
executeAction: (body) => requestClientAsApiResponse(agentApi.mentions.executeAction(body))
|
|
44243
|
+
},
|
|
44220
44244
|
attachments: {
|
|
44221
44245
|
upload: (form) => requestMultipartContractAgentApiRoute(client, "attachmentUpload", form)
|
|
44222
44246
|
}
|
|
@@ -44473,7 +44497,7 @@ var ApiClient = class {
|
|
|
44473
44497
|
if (reaction) {
|
|
44474
44498
|
return `/internal/agent-api/messages/${reaction[1]}/reactions`;
|
|
44475
44499
|
}
|
|
44476
|
-
const channelMembership = /^\/channels\/([^/]+)\/(join|leave)$/.exec(suffix);
|
|
44500
|
+
const channelMembership = /^\/channels\/([^/]+)\/(join|leave|mute|unmute)$/.exec(suffix);
|
|
44477
44501
|
if (channelMembership) {
|
|
44478
44502
|
return `/internal/agent-api/channels/${channelMembership[1]}/${channelMembership[2]}`;
|
|
44479
44503
|
}
|
|
@@ -47210,7 +47234,8 @@ var channelLeaveCommand = defineCommand(
|
|
|
47210
47234
|
}
|
|
47211
47235
|
const agentContext = ctx.loadAgentContext();
|
|
47212
47236
|
const client = ctx.createApiClient(agentContext);
|
|
47213
|
-
const
|
|
47237
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47238
|
+
const infoRes = await agentApi.server.info();
|
|
47214
47239
|
if (!infoRes.ok) {
|
|
47215
47240
|
throw new CliError({
|
|
47216
47241
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47228,7 +47253,7 @@ var channelLeaveCommand = defineCommand(
|
|
|
47228
47253
|
writeText(ctx.io, formatAlreadyNotJoined(target) + "\n");
|
|
47229
47254
|
return;
|
|
47230
47255
|
}
|
|
47231
|
-
const leaveRes = await
|
|
47256
|
+
const leaveRes = await agentApi.channels.leave({
|
|
47232
47257
|
channelId: channel.id
|
|
47233
47258
|
});
|
|
47234
47259
|
if (!leaveRes.ok) {
|
|
@@ -47271,7 +47296,8 @@ var channelJoinCommand = defineCommand(
|
|
|
47271
47296
|
}
|
|
47272
47297
|
const agentContext = ctx.loadAgentContext();
|
|
47273
47298
|
const client = ctx.createApiClient(agentContext);
|
|
47274
|
-
const
|
|
47299
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47300
|
+
const infoRes = await agentApi.server.info();
|
|
47275
47301
|
if (!infoRes.ok) {
|
|
47276
47302
|
throw new CliError({
|
|
47277
47303
|
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
@@ -47289,7 +47315,7 @@ var channelJoinCommand = defineCommand(
|
|
|
47289
47315
|
writeText(ctx.io, formatAlreadyJoined(target) + "\n");
|
|
47290
47316
|
return;
|
|
47291
47317
|
}
|
|
47292
|
-
const joinRes = await
|
|
47318
|
+
const joinRes = await agentApi.channels.join({
|
|
47293
47319
|
channelId: channel.id
|
|
47294
47320
|
});
|
|
47295
47321
|
if (!joinRes.ok) {
|
|
@@ -47305,6 +47331,82 @@ function registerChannelJoinCommand(parent, runtimeOptions) {
|
|
|
47305
47331
|
registerCliCommand(parent, channelJoinCommand, runtimeOptions);
|
|
47306
47332
|
}
|
|
47307
47333
|
init_esm_shims();
|
|
47334
|
+
function formatSeq(value) {
|
|
47335
|
+
return value == null ? "none" : String(value);
|
|
47336
|
+
}
|
|
47337
|
+
function formatChannelMuteResult(target, result2) {
|
|
47338
|
+
const lines = [
|
|
47339
|
+
`${result2.activityMuted ? "Muted" : "Unmuted"} ${target}.`,
|
|
47340
|
+
`Activity muted: ${result2.activityMuted ? "yes" : "no"}`,
|
|
47341
|
+
`Mute from seq: ${formatSeq(result2.muteFromSeq)}`
|
|
47342
|
+
];
|
|
47343
|
+
if (result2.attention?.ordinaryActivity) lines.push(result2.attention.ordinaryActivity);
|
|
47344
|
+
if (result2.attention?.stillArrives?.length) {
|
|
47345
|
+
lines.push("Still arrives:");
|
|
47346
|
+
for (const item of result2.attention.stillArrives) lines.push(`- ${item}`);
|
|
47347
|
+
}
|
|
47348
|
+
if (result2.attention?.threadBoundary) lines.push(result2.attention.threadBoundary);
|
|
47349
|
+
if (result2.attention?.catchUp) lines.push(result2.attention.catchUp);
|
|
47350
|
+
if (result2.attention?.unmuteCommand) lines.push(`To unmute: ${result2.attention.unmuteCommand}`);
|
|
47351
|
+
if (result2.attention?.unmuteApi) lines.push(`Agent API: ${result2.attention.unmuteApi}`);
|
|
47352
|
+
if (result2.attention?.muteCommand) lines.push(`To mute: ${result2.attention.muteCommand}`);
|
|
47353
|
+
if (result2.attention?.muteApi) lines.push(`Agent API: ${result2.attention.muteApi}`);
|
|
47354
|
+
return lines.join("\n");
|
|
47355
|
+
}
|
|
47356
|
+
function makeChannelMuteCommand(action) {
|
|
47357
|
+
return defineCommand(
|
|
47358
|
+
{
|
|
47359
|
+
name: action,
|
|
47360
|
+
description: action === "mute" ? "Mute ordinary Activity delivery for a regular channel" : "Unmute ordinary Activity delivery for a regular channel",
|
|
47361
|
+
arguments: ["<target>"]
|
|
47362
|
+
},
|
|
47363
|
+
async (ctx, targetArg) => {
|
|
47364
|
+
const target = String(targetArg ?? "");
|
|
47365
|
+
const channelName = parseRegularChannelTarget(target);
|
|
47366
|
+
if (!channelName) {
|
|
47367
|
+
throw new CliError({
|
|
47368
|
+
code: "INVALID_TARGET",
|
|
47369
|
+
message: "Target must be a regular channel in the form '#channel-name'. DMs and thread targets are not supported."
|
|
47370
|
+
});
|
|
47371
|
+
}
|
|
47372
|
+
const agentContext = ctx.loadAgentContext();
|
|
47373
|
+
const client = ctx.createApiClient(agentContext);
|
|
47374
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
47375
|
+
const infoRes = await agentApi.server.info();
|
|
47376
|
+
if (!infoRes.ok) {
|
|
47377
|
+
throw new CliError({
|
|
47378
|
+
code: infoRes.status >= 500 ? "SERVER_5XX" : "INFO_FAILED",
|
|
47379
|
+
message: infoRes.error ?? `HTTP ${infoRes.status}`
|
|
47380
|
+
});
|
|
47381
|
+
}
|
|
47382
|
+
const channel = (infoRes.data?.channels ?? []).find((candidate) => candidate.name === channelName);
|
|
47383
|
+
if (!channel) {
|
|
47384
|
+
throw new CliError({
|
|
47385
|
+
code: "NOT_FOUND",
|
|
47386
|
+
message: `Channel not found: ${target}`
|
|
47387
|
+
});
|
|
47388
|
+
}
|
|
47389
|
+
const res = action === "mute" ? await agentApi.channels.mute({ channelId: channel.id }) : await agentApi.channels.unmute({ channelId: channel.id });
|
|
47390
|
+
if (!res.ok) {
|
|
47391
|
+
throw new CliError({
|
|
47392
|
+
code: res.status >= 500 ? "SERVER_5XX" : action === "mute" ? "MUTE_FAILED" : "UNMUTE_FAILED",
|
|
47393
|
+
message: res.error ?? `HTTP ${res.status}`,
|
|
47394
|
+
suggestedNextAction: res.suggestedNextAction ?? void 0
|
|
47395
|
+
});
|
|
47396
|
+
}
|
|
47397
|
+
writeText(ctx.io, formatChannelMuteResult(target, res.data ?? {}) + "\n");
|
|
47398
|
+
}
|
|
47399
|
+
);
|
|
47400
|
+
}
|
|
47401
|
+
var channelMuteCommand = makeChannelMuteCommand("mute");
|
|
47402
|
+
var channelUnmuteCommand = makeChannelMuteCommand("unmute");
|
|
47403
|
+
function registerChannelMuteCommand(parent, runtimeOptions) {
|
|
47404
|
+
registerCliCommand(parent, channelMuteCommand, runtimeOptions);
|
|
47405
|
+
}
|
|
47406
|
+
function registerChannelUnmuteCommand(parent, runtimeOptions) {
|
|
47407
|
+
registerCliCommand(parent, channelUnmuteCommand, runtimeOptions);
|
|
47408
|
+
}
|
|
47409
|
+
init_esm_shims();
|
|
47308
47410
|
var serverInfoCommand = defineCommand(
|
|
47309
47411
|
{
|
|
47310
47412
|
name: "info",
|
|
@@ -47313,7 +47415,7 @@ var serverInfoCommand = defineCommand(
|
|
|
47313
47415
|
async (ctx) => {
|
|
47314
47416
|
const agentContext = ctx.loadAgentContext();
|
|
47315
47417
|
const client = ctx.createApiClient(agentContext);
|
|
47316
|
-
const res = await
|
|
47418
|
+
const res = await createAgentApiSurfaceClient(client).server.info();
|
|
47317
47419
|
if (!res.ok) {
|
|
47318
47420
|
const code = res.status >= 500 ? "SERVER_5XX" : "INFO_FAILED";
|
|
47319
47421
|
throw new CliError({
|
|
@@ -47335,13 +47437,13 @@ function registerServerInfoCommand(parent, runtimeOptions) {
|
|
|
47335
47437
|
registerCliCommand(parent, serverInfoCommand, runtimeOptions);
|
|
47336
47438
|
}
|
|
47337
47439
|
init_esm_shims();
|
|
47338
|
-
function buildKnowledgeGetPath(
|
|
47440
|
+
function buildKnowledgeGetPath(topic, opts) {
|
|
47339
47441
|
const params = new URLSearchParams();
|
|
47340
47442
|
params.set("topic", topic);
|
|
47341
47443
|
if (opts.reason) params.set("reason", opts.reason);
|
|
47342
47444
|
if (opts.turnId) params.set("turn_id", opts.turnId);
|
|
47343
47445
|
if (opts.traceId) params.set("trace_id", opts.traceId);
|
|
47344
|
-
return `/internal/agent
|
|
47446
|
+
return `/internal/agent-api/knowledge?${params.toString()}`;
|
|
47345
47447
|
}
|
|
47346
47448
|
function formatKnowledgeStdout(content) {
|
|
47347
47449
|
return content.endsWith("\n") ? content : `${content}
|
|
@@ -47391,7 +47493,7 @@ var knowledgeGetCommand = defineCommand(
|
|
|
47391
47493
|
const client = ctx.createApiClient(agentContext);
|
|
47392
47494
|
const res = await client.request(
|
|
47393
47495
|
"GET",
|
|
47394
|
-
buildKnowledgeGetPath(
|
|
47496
|
+
buildKnowledgeGetPath(topic, opts)
|
|
47395
47497
|
);
|
|
47396
47498
|
if (!res.ok) {
|
|
47397
47499
|
throw new CliError({
|
|
@@ -48180,7 +48282,7 @@ var messageSendCommand = defineCommand(
|
|
|
48180
48282
|
if (outgoingAttachmentIds.length > 0) {
|
|
48181
48283
|
body.attachmentIds = outgoingAttachmentIds;
|
|
48182
48284
|
}
|
|
48183
|
-
const agentApi =
|
|
48285
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48184
48286
|
const res = await agentApi.messages.send(body);
|
|
48185
48287
|
if (!res.ok) {
|
|
48186
48288
|
const code = res.status >= 500 ? "SERVER_5XX" : "SEND_FAILED";
|
|
@@ -48410,7 +48512,7 @@ var messageReadCommand = defineCommand(
|
|
|
48410
48512
|
const readOpts = validateReadOpts(opts);
|
|
48411
48513
|
const agentContext = ctx.loadAgentContext();
|
|
48412
48514
|
const client = ctx.createApiClient(agentContext);
|
|
48413
|
-
const agentApi =
|
|
48515
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48414
48516
|
const res = await agentApi.history.read({
|
|
48415
48517
|
channel: readOpts.channel,
|
|
48416
48518
|
...readOpts.before !== void 0 ? { before: readOpts.before } : {},
|
|
@@ -48599,7 +48701,7 @@ var messageResolveCommand = defineCommand(
|
|
|
48599
48701
|
}
|
|
48600
48702
|
const agentContext = ctx.loadAgentContext();
|
|
48601
48703
|
const client = ctx.createApiClient(agentContext);
|
|
48602
|
-
const res = await
|
|
48704
|
+
const res = await createAgentApiSurfaceClient(client).messages.resolve({ msgId: asMessageId(id) });
|
|
48603
48705
|
if (!res.ok) {
|
|
48604
48706
|
const mapped = mapResolveError(res);
|
|
48605
48707
|
throw new CliError(mapped);
|
|
@@ -48656,7 +48758,7 @@ var messageReactCommand = defineCommand(
|
|
|
48656
48758
|
}
|
|
48657
48759
|
const agentContext = ctx.loadAgentContext();
|
|
48658
48760
|
const client = ctx.createApiClient(agentContext);
|
|
48659
|
-
const agentApi =
|
|
48761
|
+
const agentApi = createAgentApiSurfaceClient(client);
|
|
48660
48762
|
const messageId = asMessageId(opts.messageId.trim());
|
|
48661
48763
|
const res = opts.remove ? await agentApi.messages.removeReaction({ msgId: messageId }, { emoji: emoji3 }) : await agentApi.messages.addReaction({ msgId: messageId }, { emoji: emoji3 });
|
|
48662
48764
|
if (!res.ok) {
|
|
@@ -49326,7 +49428,7 @@ function buildMentionExecuteCommand(action) {
|
|
|
49326
49428
|
const ids = normalizeResolutionIds(resolutionIds);
|
|
49327
49429
|
const agentContext = ctx.loadAgentContext();
|
|
49328
49430
|
const client = ctx.createApiClient(agentContext);
|
|
49329
|
-
const res = await
|
|
49431
|
+
const res = await createAgentApiSurfaceClient(client).mentions.executeAction({
|
|
49330
49432
|
action,
|
|
49331
49433
|
resolutionIds: ids
|
|
49332
49434
|
});
|
|
@@ -49356,7 +49458,7 @@ var mentionPendingCommand = defineCommand(
|
|
|
49356
49458
|
async (ctx, opts = {}) => {
|
|
49357
49459
|
const agentContext = ctx.loadAgentContext();
|
|
49358
49460
|
const client = ctx.createApiClient(agentContext);
|
|
49359
|
-
const res = await
|
|
49461
|
+
const res = await createAgentApiSurfaceClient(client).mentions.pendingActions();
|
|
49360
49462
|
if (!res.ok || !res.data) {
|
|
49361
49463
|
throw cliError(res.status >= 500 ? "SERVER_5XX" : "MENTION_PENDING_FAILED", res.error ?? `HTTP ${res.status}`);
|
|
49362
49464
|
}
|
|
@@ -49976,9 +50078,15 @@ function sanitizePathSegment(value) {
|
|
|
49976
50078
|
const segment = value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
49977
50079
|
return segment || "service";
|
|
49978
50080
|
}
|
|
49979
|
-
function resolveSlockHome(env) {
|
|
49980
|
-
|
|
49981
|
-
|
|
50081
|
+
function resolveSlockHome(env, homeDir = os4.homedir()) {
|
|
50082
|
+
const configured = env.SLOCK_HOME?.trim() || env.RAFT_HOME?.trim();
|
|
50083
|
+
const raw = configured && configured.length > 0 ? configured : path8.join(homeDir, ".slock");
|
|
50084
|
+
return path8.resolve(expandHome(raw, homeDir));
|
|
50085
|
+
}
|
|
50086
|
+
function expandHome(input, homeDir) {
|
|
50087
|
+
if (input === "~") return homeDir;
|
|
50088
|
+
if (input.startsWith("~/")) return path8.join(homeDir, input.slice(2));
|
|
50089
|
+
return input;
|
|
49982
50090
|
}
|
|
49983
50091
|
function buildLocalCliProfileEnv(input) {
|
|
49984
50092
|
if (input.manifest.execution.mode !== "local_cli" || !input.manifest.execution.command) {
|
|
@@ -49990,7 +50098,7 @@ function buildLocalCliProfileEnv(input) {
|
|
|
49990
50098
|
if (input.manifest.credential_boundary.forbid_user_home !== true) {
|
|
49991
50099
|
throw new Error("manifest must set credential_boundary.forbid_user_home=true for local_cli isolation");
|
|
49992
50100
|
}
|
|
49993
|
-
const root = resolveSlockHome(input.env ?? process.env);
|
|
50101
|
+
const root = resolveSlockHome(input.env ?? process.env, input.homeDir);
|
|
49994
50102
|
const profileHome = path8.join(
|
|
49995
50103
|
root,
|
|
49996
50104
|
"integration-profiles",
|
|
@@ -50720,10 +50828,12 @@ var agentCmd = program2.command("agent").description("External agent onboarding
|
|
|
50720
50828
|
registerAgentLoginCommand(agentCmd);
|
|
50721
50829
|
registerAgentListCommand(agentCmd);
|
|
50722
50830
|
registerAgentBridgeCommand(agentCmd);
|
|
50723
|
-
var channelCmd = program2.command("channel").description("Channel membership operations");
|
|
50831
|
+
var channelCmd = program2.command("channel").description("Channel membership and attention operations");
|
|
50724
50832
|
registerChannelMembersCommand(channelCmd);
|
|
50725
50833
|
registerChannelJoinCommand(channelCmd);
|
|
50726
50834
|
registerChannelLeaveCommand(channelCmd);
|
|
50835
|
+
registerChannelMuteCommand(channelCmd);
|
|
50836
|
+
registerChannelUnmuteCommand(channelCmd);
|
|
50727
50837
|
var threadCmd = program2.command("thread").description("Thread attention operations");
|
|
50728
50838
|
registerThreadUnfollowCommand(threadCmd);
|
|
50729
50839
|
var serverCmd = program2.command("server").description("Server / workspace introspection");
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DAEMON_CLI_USAGE,
|
|
4
4
|
DaemonCore,
|
|
5
|
-
parseDaemonCliArgs
|
|
6
|
-
|
|
5
|
+
parseDaemonCliArgs,
|
|
6
|
+
scrubDaemonAuthEnv
|
|
7
|
+
} from "./chunk-YAQHU63I.js";
|
|
7
8
|
|
|
8
9
|
// src/index.ts
|
|
9
|
-
var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
|
|
10
|
+
var parsedArgs = parseDaemonCliArgs(process.argv.slice(2), process.env);
|
|
11
|
+
scrubDaemonAuthEnv(process.env);
|
|
10
12
|
if (!parsedArgs) {
|
|
11
13
|
console.error(DAEMON_CLI_USAGE);
|
|
12
14
|
process.exit(1);
|