@alook/daemon 0.1.53 → 0.1.54

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/index.js CHANGED
@@ -22349,6 +22349,58 @@ var CommunityMessagesReadSchema = exports_external.strictObject({
22349
22349
  page: CommunityPageSchema,
22350
22350
  surfaceReceipt: exports_external.strictObject({ channelId: id, surfaceKind: exports_external.enum(["channel", "forum", "thread", "dm"]) })
22351
22351
  });
22352
+ var CommunityConversationEntryReadSchema = CommunityMessagesReadSchema.extend({
22353
+ viewerId: id,
22354
+ peer: CommunityResourceProfileSchema.nullable(),
22355
+ channel: CommunityChannelResourceSchema,
22356
+ access: CommunityAccessDecisionSchema.extend({ canRead: exports_external.literal(true) }),
22357
+ readState: CommunityReadStateResourceSchema,
22358
+ readStateRevision: exports_external.number().int().nonnegative(),
22359
+ forumFeed: exports_external.lazy(() => CommunityThreadsReadSchema).optional(),
22360
+ opener: CommunityMessageResourceSchema.optional(),
22361
+ parent: CommunityChannelResourceSchema.optional(),
22362
+ selection: exports_external.strictObject({
22363
+ reason: exports_external.enum(["explicit_anchor", "read_pointer", "tail", "read_pointer_missing"]),
22364
+ anchorMessageId: nullableId
22365
+ })
22366
+ }).superRefine((entry, ctx) => {
22367
+ for (const [path, channelId] of [
22368
+ [["channel", "id"], entry.channel.id],
22369
+ [["access", "channelId"], entry.access.channelId],
22370
+ [["readState", "channelId"], entry.readState.channelId],
22371
+ [["surfaceReceipt", "channelId"], entry.surfaceReceipt.channelId],
22372
+ ...entry.messages.map((message2, index2) => [["messages", index2, "channelId"], message2.channelId])
22373
+ ]) {
22374
+ if (channelId !== entry.channelId)
22375
+ ctx.addIssue({ code: "custom", path: [...path], message: "Conversation entry scope mismatch" });
22376
+ }
22377
+ if (entry.channel.type === "dm" !== (entry.peer !== null) || entry.peer?.id === entry.viewerId)
22378
+ ctx.addIssue({ code: "custom", path: ["peer"], message: "Conversation entry peer mismatch" });
22379
+ if (entry.opener && (entry.channel.type !== "thread" || entry.opener.id !== entry.channel.parentMessageId || entry.opener.channelId !== entry.channel.parentChannelId))
22380
+ ctx.addIssue({ code: "custom", path: ["opener"], message: "Conversation entry opener scope mismatch" });
22381
+ if (entry.parent && (entry.channel.type !== "thread" || entry.parent.id !== entry.channel.parentChannelId || entry.parent.serverId !== entry.channel.serverId || entry.parent.type !== "text" && entry.parent.type !== "forum"))
22382
+ ctx.addIssue({ code: "custom", path: ["parent"], message: "Conversation entry parent scope mismatch" });
22383
+ if (entry.forumFeed && (entry.channel.type !== "forum" || entry.forumFeed.channelId !== entry.channelId || entry.forumFeed.channel.id !== entry.channelId || entry.forumFeed.channel.serverId !== entry.channel.serverId || entry.forumFeed.threads.some((thread) => thread.parentChannelId !== entry.channelId || thread.serverId !== entry.channel.serverId)))
22384
+ ctx.addIssue({ code: "custom", path: ["forumFeed"], message: "Conversation entry forum scope mismatch" });
22385
+ if (entry.forumFeed) {
22386
+ const feed = entry.forumFeed, children = new Set(feed.threads.map((thread) => thread.id)), profiles = new Set(feed.included.profiles.map((profile2) => profile2.id));
22387
+ const openers = new Set(feed.threads.flatMap((thread) => thread.parentMessageId ? [thread.parentMessageId] : []));
22388
+ if (feed.included.messages.some((message2) => message2.channelId !== entry.channelId && !children.has(message2.channelId)) || feed.included.tags.some((row) => !openers.has(row.messageId)) || feed.included.participantCounts.some((row) => !children.has(row.channelId)) || feed.included.members.some((member2) => !children.has(member2.channelId) || member2.relation !== "notify" || !profiles.has(member2.userId)))
22389
+ ctx.addIssue({ code: "custom", path: ["forumFeed", "included"], message: "Conversation entry forum included scope mismatch" });
22390
+ }
22391
+ const surfaceKind = entry.channel.type === "text" ? "channel" : entry.channel.type;
22392
+ if (entry.surfaceReceipt.surfaceKind !== surfaceKind)
22393
+ ctx.addIssue({ code: "custom", path: ["surfaceReceipt", "surfaceKind"], message: "Conversation entry surface mismatch" });
22394
+ if (entry.channel.archived)
22395
+ ctx.addIssue({ code: "custom", path: ["channel", "archived"], message: "Conversation entry is archived" });
22396
+ const anchored = entry.selection.reason === "explicit_anchor" || entry.selection.reason === "read_pointer";
22397
+ if (anchored !== (entry.selection.anchorMessageId !== null))
22398
+ ctx.addIssue({ code: "custom", path: ["selection"], message: "Conversation entry selection mismatch" });
22399
+ if (entry.selection.reason === "read_pointer" && entry.selection.anchorMessageId !== entry.readState.lastReadMessageId)
22400
+ ctx.addIssue({ code: "custom", path: ["selection", "anchorMessageId"], message: "Conversation entry read pointer mismatch" });
22401
+ if (entry.selection.reason === "read_pointer_missing" && entry.readState.lastReadMessageId === null)
22402
+ ctx.addIssue({ code: "custom", path: ["selection", "reason"], message: "Conversation entry missing read pointer" });
22403
+ });
22352
22404
  var CommunityMessagePostedSchema = CommunityMessagesReadSchema.pick({ contractVersion: true, channelId: true }).extend({
22353
22405
  message: CommunityMessageResourceSchema,
22354
22406
  deduped: exports_external.boolean(),
@@ -25173,6 +25225,9 @@ var nativeOauthExchangeSchema = exports_external.object({
25173
25225
  code: nativeOauthHandoffCodeSchema
25174
25226
  }).strict();
25175
25227
  var nativeOauthProofSchema = nativeOauthExchangeSchema.omit({ code: true }).strict();
25228
+ // ../shared/src/utils/community-mentions.ts
25229
+ var MENTION_IDENTIFIER_CHARACTERS = /[\p{L}\p{N}_-]/u.source;
25230
+ var ID_CHAR_RE = new RegExp(MENTION_IDENTIFIER_CHARACTERS, "u");
25176
25231
  // ../shared/src/semver.ts
25177
25232
  var RELEASE_VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
25178
25233
  function parseReleaseVersion(value) {
package/dist/index.js CHANGED
@@ -35085,6 +35085,58 @@ var CommunityMessagesReadSchema = exports_external.strictObject({
35085
35085
  page: CommunityPageSchema,
35086
35086
  surfaceReceipt: exports_external.strictObject({ channelId: id, surfaceKind: exports_external.enum(["channel", "forum", "thread", "dm"]) })
35087
35087
  });
35088
+ var CommunityConversationEntryReadSchema = CommunityMessagesReadSchema.extend({
35089
+ viewerId: id,
35090
+ peer: CommunityResourceProfileSchema.nullable(),
35091
+ channel: CommunityChannelResourceSchema,
35092
+ access: CommunityAccessDecisionSchema.extend({ canRead: exports_external.literal(true) }),
35093
+ readState: CommunityReadStateResourceSchema,
35094
+ readStateRevision: exports_external.number().int().nonnegative(),
35095
+ forumFeed: exports_external.lazy(() => CommunityThreadsReadSchema).optional(),
35096
+ opener: CommunityMessageResourceSchema.optional(),
35097
+ parent: CommunityChannelResourceSchema.optional(),
35098
+ selection: exports_external.strictObject({
35099
+ reason: exports_external.enum(["explicit_anchor", "read_pointer", "tail", "read_pointer_missing"]),
35100
+ anchorMessageId: nullableId
35101
+ })
35102
+ }).superRefine((entry, ctx) => {
35103
+ for (const [path13, channelId] of [
35104
+ [["channel", "id"], entry.channel.id],
35105
+ [["access", "channelId"], entry.access.channelId],
35106
+ [["readState", "channelId"], entry.readState.channelId],
35107
+ [["surfaceReceipt", "channelId"], entry.surfaceReceipt.channelId],
35108
+ ...entry.messages.map((message2, index2) => [["messages", index2, "channelId"], message2.channelId])
35109
+ ]) {
35110
+ if (channelId !== entry.channelId)
35111
+ ctx.addIssue({ code: "custom", path: [...path13], message: "Conversation entry scope mismatch" });
35112
+ }
35113
+ if (entry.channel.type === "dm" !== (entry.peer !== null) || entry.peer?.id === entry.viewerId)
35114
+ ctx.addIssue({ code: "custom", path: ["peer"], message: "Conversation entry peer mismatch" });
35115
+ if (entry.opener && (entry.channel.type !== "thread" || entry.opener.id !== entry.channel.parentMessageId || entry.opener.channelId !== entry.channel.parentChannelId))
35116
+ ctx.addIssue({ code: "custom", path: ["opener"], message: "Conversation entry opener scope mismatch" });
35117
+ if (entry.parent && (entry.channel.type !== "thread" || entry.parent.id !== entry.channel.parentChannelId || entry.parent.serverId !== entry.channel.serverId || entry.parent.type !== "text" && entry.parent.type !== "forum"))
35118
+ ctx.addIssue({ code: "custom", path: ["parent"], message: "Conversation entry parent scope mismatch" });
35119
+ if (entry.forumFeed && (entry.channel.type !== "forum" || entry.forumFeed.channelId !== entry.channelId || entry.forumFeed.channel.id !== entry.channelId || entry.forumFeed.channel.serverId !== entry.channel.serverId || entry.forumFeed.threads.some((thread) => thread.parentChannelId !== entry.channelId || thread.serverId !== entry.channel.serverId)))
35120
+ ctx.addIssue({ code: "custom", path: ["forumFeed"], message: "Conversation entry forum scope mismatch" });
35121
+ if (entry.forumFeed) {
35122
+ const feed = entry.forumFeed, children = new Set(feed.threads.map((thread) => thread.id)), profiles = new Set(feed.included.profiles.map((profile2) => profile2.id));
35123
+ const openers = new Set(feed.threads.flatMap((thread) => thread.parentMessageId ? [thread.parentMessageId] : []));
35124
+ if (feed.included.messages.some((message2) => message2.channelId !== entry.channelId && !children.has(message2.channelId)) || feed.included.tags.some((row) => !openers.has(row.messageId)) || feed.included.participantCounts.some((row) => !children.has(row.channelId)) || feed.included.members.some((member2) => !children.has(member2.channelId) || member2.relation !== "notify" || !profiles.has(member2.userId)))
35125
+ ctx.addIssue({ code: "custom", path: ["forumFeed", "included"], message: "Conversation entry forum included scope mismatch" });
35126
+ }
35127
+ const surfaceKind = entry.channel.type === "text" ? "channel" : entry.channel.type;
35128
+ if (entry.surfaceReceipt.surfaceKind !== surfaceKind)
35129
+ ctx.addIssue({ code: "custom", path: ["surfaceReceipt", "surfaceKind"], message: "Conversation entry surface mismatch" });
35130
+ if (entry.channel.archived)
35131
+ ctx.addIssue({ code: "custom", path: ["channel", "archived"], message: "Conversation entry is archived" });
35132
+ const anchored = entry.selection.reason === "explicit_anchor" || entry.selection.reason === "read_pointer";
35133
+ if (anchored !== (entry.selection.anchorMessageId !== null))
35134
+ ctx.addIssue({ code: "custom", path: ["selection"], message: "Conversation entry selection mismatch" });
35135
+ if (entry.selection.reason === "read_pointer" && entry.selection.anchorMessageId !== entry.readState.lastReadMessageId)
35136
+ ctx.addIssue({ code: "custom", path: ["selection", "anchorMessageId"], message: "Conversation entry read pointer mismatch" });
35137
+ if (entry.selection.reason === "read_pointer_missing" && entry.readState.lastReadMessageId === null)
35138
+ ctx.addIssue({ code: "custom", path: ["selection", "reason"], message: "Conversation entry missing read pointer" });
35139
+ });
35088
35140
  var CommunityMessagePostedSchema = CommunityMessagesReadSchema.pick({ contractVersion: true, channelId: true }).extend({
35089
35141
  message: CommunityMessageResourceSchema,
35090
35142
  deduped: exports_external.boolean(),
@@ -38096,6 +38148,9 @@ var nativeOauthExchangeSchema = exports_external.object({
38096
38148
  code: nativeOauthHandoffCodeSchema
38097
38149
  }).strict();
38098
38150
  var nativeOauthProofSchema = nativeOauthExchangeSchema.omit({ code: true }).strict();
38151
+ // ../shared/src/utils/community-mentions.ts
38152
+ var MENTION_IDENTIFIER_CHARACTERS = /[\p{L}\p{N}_-]/u.source;
38153
+ var ID_CHAR_RE = new RegExp(MENTION_IDENTIFIER_CHARACTERS, "u");
38099
38154
  // src/manager/memoryMaintenancePrompt.ts
38100
38155
  var MEMORY_MAINTENANCE_PROMPT = `The daemon is preparing to reset this idle session. First, clean up your memory so the next session does not inherit incorrect or outdated notes.
38101
38156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/daemon",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "description": "Alook agent daemon — host-side runtime backend, process manager, credential proxy, and control plane.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",