@clawos-dev/clawd 0.2.242 → 0.2.244
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/cli.cjs +58 -5
- package/dist/dispatch/mcp-server.cjs +28 -1
- package/dist/share-md-viewer-error.html +1 -1
- package/dist/share-md-viewer.html +1 -1
- package/dist/share-ui/assets/guest-E3E4Ik_Z.css +32 -0
- package/dist/share-ui/assets/{guest-BtdshAz9.js → guest-RRLKEEfG.js} +120 -120
- package/dist/share-ui/guest.html +2 -2
- package/package.json +1 -1
- package/dist/share-ui/assets/guest-Dx-pn5IU.css +0 -32
package/dist/cli.cjs
CHANGED
|
@@ -4681,7 +4681,7 @@ var init_persona_schemas = __esm({
|
|
|
4681
4681
|
});
|
|
4682
4682
|
|
|
4683
4683
|
// ../protocol/src/schemas.ts
|
|
4684
|
-
var SessionStatusSchema, UsageSchema, ContextUsageSchema, sessionMetaShape, SessionMetaSchema, ModelInfoSchema, ModeInfoSchema, ConfigFieldSchemaSchema, CapabilitiesGetArgs, ToolFeaturesSchema, CapabilitiesResponseSchema, AllowRuleSchema, SessionFileSchema, ParsedEventBase, HistoryUserMetaSchema, SubagentToolStatsSchema, StructuredPatchHunkSchema, ToolResultExtraSchema, MemoryEntrySchema, AskQuestionOptionSchema, AskQuestionItemSchema, ParsedEventSchema, SessionCreateArgs, SessionIdArgs, SessionUpdateArgs, SessionSendArgs, SessionRewindArgs, SessionRewindResponseSchema, SessionRewindDiffArgs, RewindDiffHunkSchema, RewindDiffFileSchema, SessionRewindDiffResponseSchema, SessionRewindableMessageIdsArgs, SessionRewindableMessageIdsResponseSchema, SessionResumeArgs, SessionForkArgs, SessionForkResponseSchema, SessionObserveArgs, SessionEventsArgs, PermissionRespondArgs, HistoryListArgs, HistoryReadArgs, HistorySubagentsArgs, HistorySubagentReadArgs, WorkspaceListArgs, WorkspaceReadArgs, SkillsListArgs, SkillEntrySchema, AgentEntrySchema, AgentsListArgs, AgentsListResponseSchema, SessionSubscribeArgs, SessionPinArgs, PeerSessionUpsertArgs, PeerSessionUpsertResponseSchema, PeerSessionRemoveArgs, PeerSessionRemoveResponseSchema, SessionReorderPinsArgs, GitRootArgs, GitRootResponseSchema, GitBranchArgs, GitBranchResponseSchema, GitBranchesArgs, GitBranchesResponseSchema, HistoryRecentDirsArgs, RecentDirEntrySchema, HistoryRecentDirsResponseSchema, SessionQuestionFrameSchema, SessionQuestionClearedFrameSchema, AnswerQuestionArgs, AnswerQuestionResponseSchema, CancelQuestionArgs, CancelQuestionResponseSchema, AuthRequestFrameSchema, AuthOkFrameSchema, TunnelReadyEventSchema, TunnelExitedEventSchema, TunnelUnavailableEventSchema, InfoRunningSessionSchema, InfoResponseSchema, PROJECT_PORT_MIN, PROJECT_PORT_MAX, projectNameRegex, DEFAULT_DEV_COMMAND, ProjectMetadataSchema, PROJECT_STAGE_VALUES, ProjectStageSchema, ProjectWithStatusSchema, ListProjectsArgsSchema, ListProjectsResultSchema, GetProjectArgsSchema, GetProjectResultSchema, CreateProjectArgsSchema, CreateProjectResultSchema, DeleteProjectArgsSchema, DeleteProjectResultSchema, UpdateProjectPortArgsSchema, UpdateProjectPortResultSchema, SetProdUrlArgsSchema, SetProdUrlResultSchema, StartDevServerArgsSchema, StartDevServerResultSchema, ASSISTANT_REPORTABLE_STAGES, ReportStageArgsSchema, ReportStageResultSchema, StopDevServerArgsSchema, StopDevServerResultSchema, AppBuilderProjectUpdatedEventSchema, PublishArgsSchema, PublishResultSchema, DismissPublishJobArgsSchema, DismissPublishJobResultSchema, AppBuilderPublishProgressEventSchema, AppBuilderPublishFailedEventSchema;
|
|
4684
|
+
var SessionStatusSchema, UsageSchema, ContextUsageSchema, sessionMetaShape, SessionMetaSchema, ModelInfoSchema, ModeInfoSchema, ConfigFieldSchemaSchema, CapabilitiesGetArgs, ToolFeaturesSchema, CapabilitiesResponseSchema, AllowRuleSchema, SessionFileSchema, ParsedEventBase, HistoryUserMetaSchema, SubagentToolStatsSchema, StructuredPatchHunkSchema, ToolResultExtraSchema, MemoryEntrySchema, AskQuestionOptionSchema, AskQuestionItemSchema, ParsedEventSchema, SessionCreateArgs, SessionListArgs, SessionIdArgs, SessionUpdateArgs, SessionSendArgs, SessionRewindArgs, SessionRewindResponseSchema, SessionRewindDiffArgs, RewindDiffHunkSchema, RewindDiffFileSchema, SessionRewindDiffResponseSchema, SessionRewindableMessageIdsArgs, SessionRewindableMessageIdsResponseSchema, SessionResumeArgs, SessionForkArgs, SessionForkResponseSchema, SessionObserveArgs, SessionEventsArgs, PermissionRespondArgs, HistoryListArgs, HistoryReadArgs, HistorySubagentsArgs, HistorySubagentReadArgs, WorkspaceListArgs, WorkspaceReadArgs, SkillsListArgs, SkillEntrySchema, AgentEntrySchema, AgentsListArgs, AgentsListResponseSchema, SessionSubscribeArgs, SessionPinArgs, PeerSessionUpsertArgs, PeerSessionUpsertResponseSchema, PeerSessionRemoveArgs, PeerSessionRemoveResponseSchema, SessionReorderPinsArgs, GitRootArgs, GitRootResponseSchema, GitBranchArgs, GitBranchResponseSchema, GitBranchesArgs, GitBranchesResponseSchema, HistoryRecentDirsArgs, RecentDirEntrySchema, HistoryRecentDirsResponseSchema, SessionQuestionFrameSchema, SessionQuestionClearedFrameSchema, AnswerQuestionArgs, AnswerQuestionResponseSchema, CancelQuestionArgs, CancelQuestionResponseSchema, AuthRequestFrameSchema, AuthOkFrameSchema, TunnelReadyEventSchema, TunnelExitedEventSchema, TunnelUnavailableEventSchema, InfoRunningSessionSchema, InfoResponseSchema, PROJECT_PORT_MIN, PROJECT_PORT_MAX, projectNameRegex, DEFAULT_DEV_COMMAND, ProjectMetadataSchema, PROJECT_STAGE_VALUES, ProjectStageSchema, ProjectWithStatusSchema, ListProjectsArgsSchema, ListProjectsResultSchema, GetProjectArgsSchema, GetProjectResultSchema, CreateProjectArgsSchema, CreateProjectResultSchema, DeleteProjectArgsSchema, DeleteProjectResultSchema, UpdateProjectPortArgsSchema, UpdateProjectPortResultSchema, SetProdUrlArgsSchema, SetProdUrlResultSchema, StartDevServerArgsSchema, StartDevServerResultSchema, ASSISTANT_REPORTABLE_STAGES, ReportStageArgsSchema, ReportStageResultSchema, StopDevServerArgsSchema, StopDevServerResultSchema, AppBuilderProjectUpdatedEventSchema, PublishArgsSchema, PublishResultSchema, DismissPublishJobArgsSchema, DismissPublishJobResultSchema, AppBuilderPublishProgressEventSchema, AppBuilderPublishFailedEventSchema;
|
|
4685
4685
|
var init_schemas = __esm({
|
|
4686
4686
|
"../protocol/src/schemas.ts"() {
|
|
4687
4687
|
"use strict";
|
|
@@ -4861,6 +4861,15 @@ var init_schemas = __esm({
|
|
|
4861
4861
|
* - native `session:*` handler 完全不感知 mirror(UI 操作 mirror 不走 native 路径)
|
|
4862
4862
|
*/
|
|
4863
4863
|
originOwnerPrincipalId: external_exports.string().min(1).optional(),
|
|
4864
|
+
/**
|
|
4865
|
+
* Mirror 的 persona 身份(2026-07-17 android-dispatch-task spec §3.2):
|
|
4866
|
+
* 该 mirror 在朋友 daemon 上是用哪个 persona 创建的(朋友侧的 persona id)。
|
|
4867
|
+
* 与 originOwnerPrincipalId 平行的「位置」语义——**不参与**本机 persona 反查
|
|
4868
|
+
* (那是 ownerPersonaId 的职责,mirror 上按 #750 防线 strip)。
|
|
4869
|
+
* 消费方:mobile picker「借的」组按 (originOwnerPrincipalId, originOwnerPersonaId) 去重。
|
|
4870
|
+
* 写入方:ui toMirrorSessionFile / mobile buildMirrorUpsertArgs 在 strip ownerPersonaId 时 stamp。
|
|
4871
|
+
*/
|
|
4872
|
+
originOwnerPersonaId: external_exports.string().min(1).optional(),
|
|
4864
4873
|
/**
|
|
4865
4874
|
* Dispatch 派生的 session 在 create 时记录源 session 的 sessionId(稳定 key);
|
|
4866
4875
|
* sidebar 据此把 dispatch 出来的 sub-session 折叠在源 session 下。非 dispatch session 缺省。
|
|
@@ -5113,6 +5122,12 @@ var init_schemas = __esm({
|
|
|
5113
5122
|
}).refine((args) => args.cwd != null || args.ownerPersonaId != null, {
|
|
5114
5123
|
message: "cwd \u4E0E ownerPersonaId \u81F3\u5C11\u4F20\u4E00\u4E2A"
|
|
5115
5124
|
});
|
|
5125
|
+
SessionListArgs = external_exports.object({
|
|
5126
|
+
/** true = 只返回 mirror(originOwnerPrincipalId 非空,即「我在朋友 daemon 上创建」的本机存证)。 */
|
|
5127
|
+
originOnly: external_exports.boolean().optional(),
|
|
5128
|
+
/** 按 updatedAt desc(list 的既有排序)截断前 N 条。 */
|
|
5129
|
+
limit: external_exports.number().int().positive().optional()
|
|
5130
|
+
});
|
|
5116
5131
|
SessionIdArgs = external_exports.object({ sessionId: external_exports.string().min(1) });
|
|
5117
5132
|
SessionUpdateArgs = external_exports.object({
|
|
5118
5133
|
sessionId: external_exports.string().min(1),
|
|
@@ -5330,7 +5345,19 @@ var init_schemas = __esm({
|
|
|
5330
5345
|
* selfUrl 保留:它只是"可达地址"(auto-reverse 反向连接用),不是身份——填错只影响
|
|
5331
5346
|
* 反向连通性,不构成伪造风险,且 url 不在 token 里(token 只签身份不签地址)。
|
|
5332
5347
|
*/
|
|
5333
|
-
selfUrl: external_exports.string().min(1).optional()
|
|
5348
|
+
selfUrl: external_exports.string().min(1).optional(),
|
|
5349
|
+
/**
|
|
5350
|
+
* 客户端自报的 user-agent 性质标签(诊断/展示用)。
|
|
5351
|
+
* 同 selfUrl 性质的「自报事实」,非身份(决策 #16 边界):不参与鉴权、不参与路由、
|
|
5352
|
+
* 任何 handler 不得据此做权限判断。name 约定命名('clawd-desktop' / 'clawd-web' /
|
|
5353
|
+
* 'clawd-mobile-android' / ...),宽容未知值(将来加新客户端不动 schema)。
|
|
5354
|
+
* instanceId:客户端首启生成 UUID 并本地持久化——区分同种类多实例(多手机/多 desktop 同连)。
|
|
5355
|
+
*/
|
|
5356
|
+
clientInfo: external_exports.object({
|
|
5357
|
+
name: external_exports.string().min(1),
|
|
5358
|
+
version: external_exports.string().min(1),
|
|
5359
|
+
instanceId: external_exports.string().min(1)
|
|
5360
|
+
}).optional()
|
|
5334
5361
|
});
|
|
5335
5362
|
AuthOkFrameSchema = external_exports.object({
|
|
5336
5363
|
type: external_exports.literal("auth:ok"),
|
|
@@ -50120,6 +50147,16 @@ var LocalWsServer = class {
|
|
|
50120
50147
|
const c = this.clients.get(clientId);
|
|
50121
50148
|
if (!c) return;
|
|
50122
50149
|
c.ctx = ctx;
|
|
50150
|
+
if (ctx.clientInfo) {
|
|
50151
|
+
this.logger?.info("client authed", {
|
|
50152
|
+
clientId,
|
|
50153
|
+
principalId: ctx.principal.id,
|
|
50154
|
+
principalKind: ctx.principal.kind,
|
|
50155
|
+
clientName: ctx.clientInfo.name,
|
|
50156
|
+
clientVersion: ctx.clientInfo.version,
|
|
50157
|
+
clientInstanceId: ctx.clientInfo.instanceId
|
|
50158
|
+
});
|
|
50159
|
+
}
|
|
50123
50160
|
if (ctx.principal.kind === "guest") {
|
|
50124
50161
|
let set = this.guestIdToClients.get(ctx.principal.id);
|
|
50125
50162
|
if (!set) {
|
|
@@ -50492,6 +50529,9 @@ var AuthGate = class {
|
|
|
50492
50529
|
}
|
|
50493
50530
|
ctx = this.opts.buildOwnerContext?.() ?? null;
|
|
50494
50531
|
}
|
|
50532
|
+
if (ctx && parsed.data.clientInfo) {
|
|
50533
|
+
ctx = { ...ctx, clientInfo: parsed.data.clientInfo };
|
|
50534
|
+
}
|
|
50495
50535
|
if (st.timer != null) {
|
|
50496
50536
|
const clear = this.opts.clearTimer ?? ((h) => clearTimeout(h));
|
|
50497
50537
|
clear(st.timer);
|
|
@@ -53880,15 +53920,28 @@ function buildSessionHandlers(deps) {
|
|
|
53880
53920
|
);
|
|
53881
53921
|
return { response: { type: "session:info", ...response }, broadcast };
|
|
53882
53922
|
};
|
|
53883
|
-
const list = async (
|
|
53923
|
+
const list = async (frame, _client, ctx) => {
|
|
53924
|
+
const args = SessionListArgs.parse(frame ?? {});
|
|
53925
|
+
const narrow = (sessions) => {
|
|
53926
|
+
let out = sessions;
|
|
53927
|
+
if (args.originOnly) out = out.filter((s) => s.originOwnerPrincipalId != null);
|
|
53928
|
+
if (args.limit != null) out = out.slice(0, args.limit);
|
|
53929
|
+
return out;
|
|
53930
|
+
};
|
|
53884
53931
|
const { response } = manager.list();
|
|
53885
53932
|
if (ctx && ctx.principal.kind === "guest") {
|
|
53886
53933
|
const sessions = response.sessions ?? [];
|
|
53887
53934
|
const guestDeviceId = ctx.principal.id;
|
|
53888
53935
|
const filtered = sessions.filter((s) => canAccessPersona(ctx.grants, s.ownerPersonaId, "read")).filter((s) => s.creatorPrincipalId === guestDeviceId);
|
|
53889
|
-
return { response: { type: "session:list", sessions: filtered } };
|
|
53936
|
+
return { response: { type: "session:list", sessions: narrow(filtered) } };
|
|
53890
53937
|
}
|
|
53891
|
-
return {
|
|
53938
|
+
return {
|
|
53939
|
+
response: {
|
|
53940
|
+
type: "session:list",
|
|
53941
|
+
...response,
|
|
53942
|
+
sessions: narrow(response.sessions ?? [])
|
|
53943
|
+
}
|
|
53944
|
+
};
|
|
53892
53945
|
};
|
|
53893
53946
|
const get = async (frame, _client, ctx) => {
|
|
53894
53947
|
const args = SessionIdArgs.parse(frame);
|
|
@@ -39913,6 +39913,15 @@ var SessionFileSchema = external_exports.object({
|
|
|
39913
39913
|
* - native `session:*` handler 完全不感知 mirror(UI 操作 mirror 不走 native 路径)
|
|
39914
39914
|
*/
|
|
39915
39915
|
originOwnerPrincipalId: external_exports.string().min(1).optional(),
|
|
39916
|
+
/**
|
|
39917
|
+
* Mirror 的 persona 身份(2026-07-17 android-dispatch-task spec §3.2):
|
|
39918
|
+
* 该 mirror 在朋友 daemon 上是用哪个 persona 创建的(朋友侧的 persona id)。
|
|
39919
|
+
* 与 originOwnerPrincipalId 平行的「位置」语义——**不参与**本机 persona 反查
|
|
39920
|
+
* (那是 ownerPersonaId 的职责,mirror 上按 #750 防线 strip)。
|
|
39921
|
+
* 消费方:mobile picker「借的」组按 (originOwnerPrincipalId, originOwnerPersonaId) 去重。
|
|
39922
|
+
* 写入方:ui toMirrorSessionFile / mobile buildMirrorUpsertArgs 在 strip ownerPersonaId 时 stamp。
|
|
39923
|
+
*/
|
|
39924
|
+
originOwnerPersonaId: external_exports.string().min(1).optional(),
|
|
39916
39925
|
/**
|
|
39917
39926
|
* Dispatch 派生的 session 在 create 时记录源 session 的 sessionId(稳定 key);
|
|
39918
39927
|
* sidebar 据此把 dispatch 出来的 sub-session 折叠在源 session 下。非 dispatch session 缺省。
|
|
@@ -40165,6 +40174,12 @@ var SessionCreateArgs = external_exports.object({
|
|
|
40165
40174
|
}).refine((args) => args.cwd != null || args.ownerPersonaId != null, {
|
|
40166
40175
|
message: "cwd \u4E0E ownerPersonaId \u81F3\u5C11\u4F20\u4E00\u4E2A"
|
|
40167
40176
|
});
|
|
40177
|
+
var SessionListArgs = external_exports.object({
|
|
40178
|
+
/** true = 只返回 mirror(originOwnerPrincipalId 非空,即「我在朋友 daemon 上创建」的本机存证)。 */
|
|
40179
|
+
originOnly: external_exports.boolean().optional(),
|
|
40180
|
+
/** 按 updatedAt desc(list 的既有排序)截断前 N 条。 */
|
|
40181
|
+
limit: external_exports.number().int().positive().optional()
|
|
40182
|
+
});
|
|
40168
40183
|
var SessionIdArgs = external_exports.object({ sessionId: external_exports.string().min(1) });
|
|
40169
40184
|
var SessionUpdateArgs = external_exports.object({
|
|
40170
40185
|
sessionId: external_exports.string().min(1),
|
|
@@ -40380,7 +40395,19 @@ var AuthRequestFrameSchema = external_exports.object({
|
|
|
40380
40395
|
* selfUrl 保留:它只是"可达地址"(auto-reverse 反向连接用),不是身份——填错只影响
|
|
40381
40396
|
* 反向连通性,不构成伪造风险,且 url 不在 token 里(token 只签身份不签地址)。
|
|
40382
40397
|
*/
|
|
40383
|
-
selfUrl: external_exports.string().min(1).optional()
|
|
40398
|
+
selfUrl: external_exports.string().min(1).optional(),
|
|
40399
|
+
/**
|
|
40400
|
+
* 客户端自报的 user-agent 性质标签(诊断/展示用)。
|
|
40401
|
+
* 同 selfUrl 性质的「自报事实」,非身份(决策 #16 边界):不参与鉴权、不参与路由、
|
|
40402
|
+
* 任何 handler 不得据此做权限判断。name 约定命名('clawd-desktop' / 'clawd-web' /
|
|
40403
|
+
* 'clawd-mobile-android' / ...),宽容未知值(将来加新客户端不动 schema)。
|
|
40404
|
+
* instanceId:客户端首启生成 UUID 并本地持久化——区分同种类多实例(多手机/多 desktop 同连)。
|
|
40405
|
+
*/
|
|
40406
|
+
clientInfo: external_exports.object({
|
|
40407
|
+
name: external_exports.string().min(1),
|
|
40408
|
+
version: external_exports.string().min(1),
|
|
40409
|
+
instanceId: external_exports.string().min(1)
|
|
40410
|
+
}).optional()
|
|
40384
40411
|
});
|
|
40385
40412
|
var AuthOkFrameSchema = external_exports.object({
|
|
40386
40413
|
type: external_exports.literal("auth:ok"),
|