@primusclaw/personal-agent 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.js +490 -19
  2. package/dist/types/assistant/chat.d.ts +1 -1
  3. package/dist/types/assistant/confirm-outcome.d.ts +2 -0
  4. package/dist/types/assistant/events.d.ts +28 -1
  5. package/dist/types/assistant/say.d.ts +9 -2
  6. package/dist/types/commands/names.d.ts +1 -1
  7. package/dist/types/config/settings.d.ts +25 -25
  8. package/dist/types/direct-chat/direct-chat.d.ts +1 -1
  9. package/dist/types/group-context/buffer.d.ts +1 -1
  10. package/dist/types/guardrails/operations.d.ts +20 -4
  11. package/dist/types/index.d.ts +2 -0
  12. package/dist/types/limits/user-limits.d.ts +3 -3
  13. package/dist/types/locales/index.d.ts +1 -0
  14. package/dist/types/locales/skills.d.ts +105 -0
  15. package/dist/types/locales/transparency.d.ts +1 -1
  16. package/dist/types/observe/observer.d.ts +1 -1
  17. package/dist/types/ports/claw/index.d.ts +4 -0
  18. package/dist/types/ports/claw/skills.d.ts +52 -0
  19. package/dist/types/ports/secret-source.d.ts +3 -2
  20. package/dist/types/ports/store/policy.d.ts +3 -3
  21. package/dist/types/protocol/claw-api/assistant-events.d.ts +47 -2
  22. package/dist/types/remote/context.d.ts +1 -1
  23. package/dist/types/remote/follow/control.d.ts +1 -1
  24. package/dist/types/remote/state.d.ts +1 -1
  25. package/dist/types/routing/credentials.d.ts +1 -1
  26. package/dist/types/routing/deps.d.ts +1 -1
  27. package/dist/types/skills/card.d.ts +4 -0
  28. package/dist/types/skills/clicks.d.ts +24 -0
  29. package/dist/types/skills/command.d.ts +22 -0
  30. package/dist/types/skills/index.d.ts +5 -0
  31. package/dist/types/skills/views.d.ts +43 -0
  32. package/dist/types/subscriptions/subscriptions.d.ts +1 -1
  33. package/package.json +1 -1
@@ -48,7 +48,7 @@ export interface AssistantChatOptions {
48
48
  readonly enabled: boolean;
49
49
  /** ASSISTANT_USERS, lower case (empty: everybody the switch is on for). */
50
50
  readonly users: ReadonlySet<string>;
51
- /** TEAMS_ASSISTANT_UNDERSTANDING_USERS, lower case (empty: nobody). */
51
+ /** PA_ASSISTANT_UNDERSTANDING_USERS, lower case (empty: nobody). */
52
52
  readonly understanding: ReadonlySet<string>;
53
53
  /** CLAW_PLUGIN_ID: named on each message; undefined for none. */
54
54
  readonly pluginId: number | undefined;
@@ -6,6 +6,8 @@ export declare function localTime(at: unknown, zone: string): string;
6
6
  export declare function commentOutcome(out: Fields, lang: Lang): string | undefined;
7
7
  /** What came of a press on an instruction card (`devenv_send`): sent, as which item, or why not. */
8
8
  export declare function devenvSendOutcome(status: string, out: Fields, lang: Lang): string;
9
+ /** What came of Save or Discard on a drafted skill's card: saved (which version), discarded, or why not. */
10
+ export declare function skillSaveOutcome(status: string, out: Fields, lang: Lang): string;
9
11
  /** What came of a press on a held write's card of `kind`, in one line: Claw's answer said plainly. */
10
12
  export declare function confirmOutcome(kind: string, out: Fields, lang: Lang): string;
11
13
  export {};
@@ -13,7 +13,7 @@ export declare const SUGGESTED_REPLY_MAX = 30;
13
13
  /** The suggested replies kept under a message when the channel's own limit is not given (`SurfaceCaps.suggestionsMax`). */
14
14
  export declare const SUGGESTIONS_MAX = 3;
15
15
  /** The writes Claw holds for the person that this worker draws as a card. */
16
- export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide"];
16
+ export declare const CONFIRM_KINDS: readonly ["trigger_create", "trigger_cancel", "devenv_send", "github_comment", "devenv_hide", "skill_save"];
17
17
  /** The default replies under what the assistant said: (what the button says, what it sends). */
18
18
  export declare const ASSISTANT_SUGGESTED_REPLIES: Readonly<Record<Lang, readonly SuggestedReply[]>>;
19
19
  type Event = Readonly<Record<string, unknown>>;
@@ -42,6 +42,33 @@ export declare function confirmWriteOf(event: Event): ConfirmWrite | undefined;
42
42
  * language (`lang`; without it, the language of `text`).
43
43
  */
44
44
  export declare function suggestedRepliesOf(event: Event, text: string, styleOn: boolean, lang?: Lang, max?: number): SuggestedReply[];
45
+ /** What a skill's card is about (`skill_card.kind`): done already, or a draft to save. */
46
+ export declare const SKILL_CARD_KINDS: readonly ["saved", "deleted", "disabled", "enabled", "draft"];
47
+ /** Code points of a skill's description on its card (Claw sends at most 300). */
48
+ export declare const SKILL_DESCRIPTION_MAX = 300;
49
+ /** Code points of the start of SKILL.md a card shows (Claw sends at most 1500). */
50
+ export declare const SKILL_PREVIEW_MAX = 1500;
51
+ /** The files a skill's card lists (Claw keeps at most 20). */
52
+ export declare const SKILL_FILES_MAX = 20;
53
+ /** One of the person's personal skills as an `assistant.say` shows it (`skill_card`). */
54
+ export interface SkillCardEvent {
55
+ readonly kind: (typeof SKILL_CARD_KINDS)[number];
56
+ readonly name: string;
57
+ readonly version: number | null;
58
+ /** `saved`: a new skill (true) or a new version of one (false). */
59
+ readonly created: boolean;
60
+ readonly description: string;
61
+ readonly manual: boolean;
62
+ readonly files: readonly string[];
63
+ readonly preview: string;
64
+ /** What Undo takes back ("" none). */
65
+ readonly changeId: string;
66
+ }
67
+ /**
68
+ * The skill an `assistant.say` is about (`skill_card`); undefined when it carries none this worker draws. Read whole or not at all:
69
+ * a name that is not one, or a kind it does not know, and there is no card (the words still say it).
70
+ */
71
+ export declare function skillCardOf(event: Event): SkillCardEvent | undefined;
45
72
  /** The fewest options a choice card shows (Claw sends from 2). */
46
73
  export declare const CHOICE_OPTIONS_MIN = 2;
47
74
  /** The most options a choice card shows (Claw sends at most 10). */
@@ -6,8 +6,9 @@
6
6
  * cites as [n], and the replies to tap under the last of its messages when no card follows.
7
7
  * - When the event's item holds a result that waits, a card with Accept and Stop; when it holds a write for the person, a card
8
8
  * that lets it through or not; when it puts a command to the person, a card with Run and Cancel; when it puts a choice to the
9
- * person, a card with the options and Send (each recorded first, so its buttons mean something). A card holds the words only
10
- * when they are short and not shown already.
9
+ * person, a card with the options and Send; when it is about one of the person's skills, the skill's card with Undo and Edit,
10
+ * or a draft's with Save and Discard (each recorded first, so its buttons mean something). A card holds the words only when they
11
+ * are short and not shown already; a skill's card always does.
11
12
  * - Then a card for each file the item's worker delivered, with Claw's own download link.
12
13
  *
13
14
  * Every word of this worker's own is in the person's language, never in that of what was said.
@@ -58,6 +59,12 @@ export declare class SayPlanner {
58
59
  * to the person; undefined for none. `holdsWords`: the card shows the words, which are then not said apart.
59
60
  */
60
61
  private card;
62
+ /**
63
+ * A personal skill the message is about (`skill_card`), recorded first: a draft is its held write (Save and Discard answer it as
64
+ * any held write is answered); anything done already records the change its Undo takes back. Undefined for none, and for a draft
65
+ * without its held write (it is then the plain held write's card).
66
+ */
67
+ private skillCard;
61
68
  /** A write Claw holds for the person (Allow, Deny) or a command put to them (Run, Cancel), recorded first; undefined for none. */
62
69
  private askCard;
63
70
  /**
@@ -6,7 +6,7 @@
6
6
  export declare const COMMANDS: readonly ["help", "new", "stop", "unlink", "whoami", "resume", "memory", "sessions"];
7
7
  /** The only commands a group chat accepts. */
8
8
  export declare const GROUP_COMMANDS: readonly ["help", "new", "stop", "whoami", "feedback"];
9
- export declare const PERSONAL_ONLY_COMMANDS: readonly ["link", "unlink", "resume", "timezone", "quiet", "pause", "brief", "repo", "sessions", "agents", "agent", "lang", "approvals"];
9
+ export declare const PERSONAL_ONLY_COMMANDS: readonly ["link", "unlink", "resume", "timezone", "quiet", "pause", "brief", "repo", "sessions", "agents", "agent", "lang", "approvals", "skills"];
10
10
  /**
11
11
  * `/feedback [TEXT]` takes an argument, so it is read with `commandArgs`, never `parseCommand`; it is listed here (not in
12
12
  * COMMANDS) only so that a group chat accepts it and an unknown `/word` is still plain text.
@@ -7,9 +7,9 @@ import type { LinkLimits } from "../ports/store/link.js";
7
7
  * mode, bot token, Service Bus, reply style). Nothing here has a built-in address: a deployment says its own.
8
8
  */
9
9
  export interface Settings {
10
- /** TEAMS_DB_PATH (default /data/state.db). */
10
+ /** PA_DB_PATH (default /data/state.db). */
11
11
  readonly dbPath: string;
12
- /** TEAMS_ENCRYPTION_KEYS, comma separated Fernet keys: the first encrypts, all decrypt. */
12
+ /** PA_ENCRYPTION_KEYS, comma separated Fernet keys: the first encrypts, all decrypt. */
13
13
  readonly encryptionKeys: readonly string[];
14
14
  /** CLAW_API_URL, without a trailing slash. */
15
15
  readonly clawApiUrl: string;
@@ -26,25 +26,25 @@ export interface Settings {
26
26
  readonly models: ModelSettings;
27
27
  readonly githubReview: GithubReviewSettings;
28
28
  readonly assistant: AssistantSettings;
29
- /** TEAMS_CLAW_EVENTS_GONE: an event for a person with no chat is answered 410 Gone instead of 200 `dropped`. */
29
+ /** PA_CLAW_EVENTS_GONE: an event for a person with no chat is answered 410 Gone instead of 200 `dropped`. */
30
30
  readonly clawEventsGone: boolean;
31
- /** TEAMS_DIRECT_CHAT and TEAMS_DIRECT_CHAT_USERS (lower-cased; empty with `on` is everybody). */
31
+ /** PA_DIRECT_CHAT and PA_DIRECT_CHAT_USERS (lower-cased; empty with `on` is everybody). */
32
32
  readonly directChat: {
33
33
  readonly enabled: boolean;
34
34
  readonly users: ReadonlySet<string>;
35
35
  };
36
- /** TEAMS_ON_BEHALF_USERS: Claw user ids (as written) whose own key may post into their own chat. */
36
+ /** PA_ON_BEHALF_USERS: Claw user ids (as written) whose own key may post into their own chat. */
37
37
  readonly onBehalfUsers: ReadonlySet<string>;
38
- /** TEAMS_OBSERVE_USERS (lower-cased): who may turn on observing a group chat. */
38
+ /** PA_OBSERVE_USERS (lower-cased): who may turn on observing a group chat. */
39
39
  readonly observeUsers: ReadonlySet<string>;
40
40
  /**
41
- * TEAMS_GROUP_CONTEXT_MESSAGES (30; 0 off), TEAMS_GROUP_CONTEXT_HOURS (4), TEAMS_GROUP_CONTEXT_CHARS (500), TEAMS_GROUP_CONTEXT_GRANTED (off): the recent
41
+ * PA_GROUP_CONTEXT_MESSAGES (30; 0 off), PA_GROUP_CONTEXT_HOURS (4), PA_GROUP_CONTEXT_CHARS (500), PA_GROUP_CONTEXT_GRANTED (off): the recent
42
42
  * messages of a group chat kept in memory as background for an @mention.
43
43
  */
44
44
  readonly groupContext: GroupContextSettings;
45
- /** TEAMS_LIMIT_<OPERATION>: the per-person limits of operations that act with someone's authority. */
45
+ /** PA_LIMIT_<OPERATION>: the per-person limits of operations that act with someone's authority. */
46
46
  readonly sensitiveLimits: ReadonlyMap<string, Limit>;
47
- /** TEAMS_LINK_MAX_FAILURES_PER_USER (5) / TEAMS_LINK_MAX_FAILURES_GLOBAL (100) / TEAMS_LINK_ATTEMPT_WINDOW_SECONDS (600). */
47
+ /** PA_LINK_MAX_FAILURES_PER_USER (5) / PA_LINK_MAX_FAILURES_GLOBAL (100) / PA_LINK_ATTEMPT_WINDOW_SECONDS (600). */
48
48
  readonly linkLimits: LinkLimits;
49
49
  readonly userLimits: UserLimits;
50
50
  /** SECRETS_SOURCE (env | keyvault). */
@@ -61,23 +61,23 @@ export interface ClawSettings {
61
61
  }
62
62
  /** Token exchange with the identity service (RFC 8693). */
63
63
  export interface ExchangeSettings {
64
- /** TEAMS_EXCHANGE_ENABLED. */
64
+ /** PA_EXCHANGE_ENABLED. */
65
65
  readonly enabled: boolean;
66
- /** TEAMS_EXCHANGE_TOKEN_URL (default PUBLIC_BASE_URL/oauth/token); "" when off. */
66
+ /** PA_EXCHANGE_TOKEN_URL (default PUBLIC_BASE_URL/oauth/token); "" when off. */
67
67
  readonly tokenUrl: string;
68
- /** TEAMS_EXCHANGE_CLIENT_ID, required when on. */
68
+ /** PA_EXCHANGE_CLIENT_ID, required when on. */
69
69
  readonly clientId: string;
70
- /** The secret TEAMS_EXCHANGE_CLIENT_SECRET, required when on. */
70
+ /** The secret PA_EXCHANGE_CLIENT_SECRET, required when on. */
71
71
  readonly clientSecret: string;
72
- /** TEAMS_EXCHANGE_ISSUER (default teams.microsoft.com). */
72
+ /** PA_EXCHANGE_ISSUER (default teams.microsoft.com). */
73
73
  readonly issuer: string;
74
- /** TEAMS_EXCHANGE_AUDIENCE (default claw-api). */
74
+ /** PA_EXCHANGE_AUDIENCE (default claw-api). */
75
75
  readonly audience: string;
76
- /** TEAMS_EXCHANGE_SCOPE (default claw.api). */
76
+ /** PA_EXCHANGE_SCOPE (default claw.api). */
77
77
  readonly scope: string;
78
- /** TEAMS_EXCHANGE_BINDING_REQUEST_URL (default PUBLIC_BASE_URL/oauth/binding-requests); "" when off. */
78
+ /** PA_EXCHANGE_BINDING_REQUEST_URL (default PUBLIC_BASE_URL/oauth/binding-requests); "" when off. */
79
79
  readonly bindingRequestUrl: string;
80
- /** TEAMS_EXCHANGE_FOR_CHAT: ordinary chats use a bound person's exchanged token instead of their linked key. */
80
+ /** PA_EXCHANGE_FOR_CHAT: ordinary chats use a bound person's exchanged token instead of their linked key. */
81
81
  readonly forChat: boolean;
82
82
  }
83
83
  /** The models sessions ask for ("" sends none: Claw's default applies). */
@@ -91,15 +91,15 @@ export interface ModelSettings {
91
91
  }
92
92
  /** Reviewing and merging a pull request for a colleague. */
93
93
  export interface GithubReviewSettings {
94
- /** TEAMS_GITHUB_REVIEW_ENABLED (needs the exchange). */
94
+ /** PA_GITHUB_REVIEW_ENABLED (needs the exchange). */
95
95
  readonly enabled: boolean;
96
- /** TEAMS_GITHUB_REVIEW_OWNERS: the GitHub owners whose pull requests are taken; required when on. */
96
+ /** PA_GITHUB_REVIEW_OWNERS: the GitHub owners whose pull requests are taken; required when on. */
97
97
  readonly owners: readonly string[];
98
- /** TEAMS_REVIEW_INTENT_MODEL (else CLAWY_MODEL) when on; "" requests are read by the rules alone. */
98
+ /** PA_REVIEW_INTENT_MODEL (else CLAWY_MODEL) when on; "" requests are read by the rules alone. */
99
99
  readonly intentModel: string;
100
- /** TEAMS_GITHUB_CREDENTIAL_URL (default PUBLIC_BASE_URL/oauth/external-credentials) when on. */
100
+ /** PA_GITHUB_CREDENTIAL_URL (default PUBLIC_BASE_URL/oauth/external-credentials) when on. */
101
101
  readonly credentialUrl: string;
102
- /** TEAMS_GITHUB_CLIENT_ID: the OAuth client of the device flow (default: the GitHub CLI's public client). */
102
+ /** PA_GITHUB_CLIENT_ID: the OAuth client of the device flow (default: the GitHub CLI's public client). */
103
103
  readonly clientId: string;
104
104
  }
105
105
  /** A person's assistant in Claw. */
@@ -110,7 +110,7 @@ export interface AssistantSettings {
110
110
  readonly users: ReadonlySet<string>;
111
111
  /** ASSISTANT_REPLY_WINDOW_SECONDS (default 1800). */
112
112
  readonly replyWindowSeconds: number;
113
- /** TEAMS_ASSISTANT_UNDERSTANDING(_USERS): whose every message the assistant understands first (empty: nobody). */
113
+ /** PA_ASSISTANT_UNDERSTANDING(_USERS): whose every message the assistant understands first (empty: nobody). */
114
114
  readonly understandingUsers: ReadonlySet<string>;
115
115
  }
116
116
  /** How many in a window; `count` 0: no limit. */
@@ -118,7 +118,7 @@ export interface Limit {
118
118
  readonly count: number;
119
119
  readonly windowSeconds: number;
120
120
  }
121
- /** TEAMS_USER_MESSAGE_LIMIT per TEAMS_USER_MESSAGE_WINDOW_SECONDS, TEAMS_USER_MAX_CONCURRENT_TASKS. */
121
+ /** PA_USER_MESSAGE_LIMIT per PA_USER_MESSAGE_WINDOW_SECONDS, PA_USER_MAX_CONCURRENT_TASKS. */
122
122
  export interface UserLimits {
123
123
  readonly messageLimit: number;
124
124
  readonly messageWindowSeconds: number;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The chat itself as the window of an agent session on the person's machine (TEAMS_DIRECT_CHAT, teams_agent/direct_chat.py).
2
+ * The chat itself as the window of an agent session on the person's machine (PA_DIRECT_CHAT, teams_agent/direct_chat.py).
3
3
  *
4
4
  * For the people it is on for, a chat attached to an agent session is a plain conversation with that agent: every message says in
5
5
  * its first line who speaks (`agentHead`, `CLAWY_HEAD`), a line of the agent's that looks like a head is escaped (`guardHeads`),
@@ -15,7 +15,7 @@ import type { Clock } from "../ports/clock.js";
15
15
  import type { Logger } from "../ports/logger.js";
16
16
  import type { GroupContextRepository } from "../ports/store/group-context.js";
17
17
  import type { InboundMessage } from "../ports/surface.js";
18
- /** How much a group's context keeps (the deployment's TEAMS_GROUP_CONTEXT_* settings). */
18
+ /** How much a group's context keeps (the deployment's PA_GROUP_CONTEXT_* settings). */
19
19
  export interface GroupContextSettings {
20
20
  /** The most messages kept per chat; 0 turns the feature off (nothing is kept). */
21
21
  readonly messages: number;
@@ -13,10 +13,26 @@ export type SensitiveOperation = keyof typeof SENSITIVE_OPERATIONS;
13
13
  export declare const SENSITIVE_OPERATION_NAMES: SensitiveOperation[];
14
14
  /** The defaults, per person: a busy coding agent asks for many approvals, a person merges a few pull requests an hour. */
15
15
  export declare const DEFAULT_LIMITS: Readonly<Record<SensitiveOperation, Limit>>;
16
- /** TEAMS_LIMIT_PR_MERGE=20/3600; 0 turns that limit off. */
16
+ /**
17
+ * TEAMS_LIMIT_PR_MERGE=20/3600; 0 turns that limit off. The prefix `parseLimits` reads when it is not given one.
18
+ *
19
+ * @deprecated The worker reads `LIMIT_ENV_PREFIX` (`PA_LIMIT_`), and `TEAMS_LIMIT_` only as its older alias; pass
20
+ * `{ prefix: LIMIT_ENV_PREFIX }` to `parseLimits`. Kept, with its value, for callers of 0.8.0 and earlier.
21
+ */
17
22
  export declare const ENV_PREFIX = "TEAMS_LIMIT_";
23
+ /** PA_LIMIT_PR_MERGE=20/3600; 0 turns that limit off. The worker's own prefix for the limits. */
24
+ export declare const LIMIT_ENV_PREFIX = "PA_LIMIT_";
25
+ /** How `parseLimits` names the variables it asks for, and the one a malformed value is reported under. */
26
+ export interface ParseLimitsOptions {
27
+ /** The prefix of each limit's name (default: `ENV_PREFIX`, `TEAMS_LIMIT_`, as before this option existed). */
28
+ readonly prefix?: string;
29
+ /** The variable a value was read from, for the error (default: the name asked for). */
30
+ readonly source?: (name: string) => string;
31
+ }
18
32
  /**
19
- * The limits from the environment: `TEAMS_LIMIT_<OPERATION>` is `COUNT/SECONDS` (`20/3600`), or `0` to turn that
20
- * limit off. Unset takes the default. Anything else throws (the worker stops at start: a typo must not lift a limit).
33
+ * The limits from the environment: `<prefix><OPERATION>` is `COUNT/SECONDS` (`20/3600`), or `0` to turn that limit
34
+ * off. Unset takes the default. Anything else throws (the worker stops at start: a typo must not lift a limit), naming
35
+ * the variable `options.source` says the value was read from. Called without options it asks for the
36
+ * `TEAMS_LIMIT_<OPERATION>` names, as it always did; the worker passes `{ prefix: LIMIT_ENV_PREFIX }`.
21
37
  */
22
- export declare function parseLimits(env: (name: string) => string): Map<SensitiveOperation, Limit>;
38
+ export declare function parseLimits(env: (name: string) => string, options?: ParseLimitsOptions): Map<SensitiveOperation, Limit>;
@@ -59,6 +59,8 @@ export * from "./approvals/index.js";
59
59
  export * from "./assistant/index.js";
60
60
  export * from "./assistant/work-items.js";
61
61
  export type * from "./assistant/views.js";
62
+ export * from "./skills/index.js";
63
+ export type { SkillCardEvent } from "./assistant/events.js";
62
64
  export * from "./direct-chat/index.js";
63
65
  export * from "./proactive/index.js";
64
66
  export * from "./proactive/views.js";
@@ -1,10 +1,10 @@
1
1
  import type { UserLimits } from "../config/settings.js";
2
- /** TEAMS_USER_MESSAGE_LIMIT: messages per window and person. */
2
+ /** PA_USER_MESSAGE_LIMIT: messages per window and person. */
3
3
  export declare const DEFAULT_MESSAGE_LIMIT = 20;
4
- /** TEAMS_USER_MESSAGE_WINDOW_SECONDS. */
4
+ /** PA_USER_MESSAGE_WINDOW_SECONDS. */
5
5
  export declare const DEFAULT_MESSAGE_WINDOW_SECONDS = 60;
6
6
  /**
7
- * TEAMS_USER_MAX_CONCURRENT_TASKS. A review request starts up to 10 pull requests at once, each a task; the default
7
+ * PA_USER_MAX_CONCURRENT_TASKS. A review request starts up to 10 pull requests at once, each a task; the default
8
8
  * leaves room for that beside the person's 1:1 chat and a group.
9
9
  */
10
10
  export declare const DEFAULT_MAX_CONCURRENT_TASKS = 12;
@@ -12,5 +12,6 @@ export * from "./assistant-chat.js";
12
12
  export * from "./assistant-devenv-hide.js";
13
13
  export * from "./assistant-work-clicks.js";
14
14
  export * from "./assistant.js";
15
+ export * from "./skills.js";
15
16
  export * from "./proactive-lines.js";
16
17
  export * from "./proactive.js";
@@ -0,0 +1,105 @@
1
+ export declare const skillText: import("./catalog.js").Catalog<{
2
+ savedTitle: (p: {
3
+ name: string;
4
+ version: number;
5
+ }) => string;
6
+ updatedTitle: (p: {
7
+ name: string;
8
+ version: number;
9
+ }) => string;
10
+ deletedTitle: (p: {
11
+ name: string;
12
+ }) => string;
13
+ disabledTitle: (p: {
14
+ name: string;
15
+ }) => string;
16
+ enabledTitle: (p: {
17
+ name: string;
18
+ }) => string;
19
+ draftTitle: (p: {
20
+ name: string;
21
+ }) => string;
22
+ whenToUse: string;
23
+ files: string;
24
+ manual: string;
25
+ autoNote: string;
26
+ draftNote: string;
27
+ undo: string;
28
+ edit: string;
29
+ save: string;
30
+ discard: string;
31
+ editTitle: (p: {
32
+ name: string;
33
+ }) => string;
34
+ editDescription: string;
35
+ editContent: string;
36
+ editSave: string;
37
+ editTooLong: (p: {
38
+ name: string;
39
+ }) => string;
40
+ undoneDeleted: (p: {
41
+ name: string;
42
+ }) => string;
43
+ undoneVersion: (p: {
44
+ name: string;
45
+ version: number;
46
+ }) => string;
47
+ undoneRestored: (p: {
48
+ name: string;
49
+ }) => string;
50
+ undoneEnabled: (p: {
51
+ name: string;
52
+ }) => string;
53
+ undoneDisabled: (p: {
54
+ name: string;
55
+ }) => string;
56
+ undoExpired: string;
57
+ undoChanged: (p: {
58
+ name: string;
59
+ }) => string;
60
+ undoDone: string;
61
+ undoFull: string;
62
+ gone: string;
63
+ failed: string;
64
+ refused: (p: {
65
+ why: string;
66
+ }) => string;
67
+ unavailable: string;
68
+ noSkills: string;
69
+ listTitle: (p: {
70
+ n: number;
71
+ }) => string;
72
+ listLine: (p: {
73
+ name: string;
74
+ version: number;
75
+ description: string;
76
+ state: string;
77
+ }) => string;
78
+ stateOff: string;
79
+ stateManual: string;
80
+ listHint: string;
81
+ showHead: (p: {
82
+ name: string;
83
+ version: number;
84
+ state: string;
85
+ }) => string;
86
+ showFiles: (p: {
87
+ files: string;
88
+ }) => string;
89
+ notFound: (p: {
90
+ name: string;
91
+ }) => string;
92
+ already: (p: {
93
+ name: string;
94
+ on: string;
95
+ }) => string;
96
+ on: string;
97
+ off: string;
98
+ usage: string;
99
+ couldNotRead: string;
100
+ draftSaved: (p: {
101
+ name: string;
102
+ version: number;
103
+ }) => string;
104
+ draftDiscarded: string;
105
+ }>;
@@ -20,7 +20,7 @@ export declare function dataLines(channel?: string): Readonly<Record<Lang, reado
20
20
  export declare const REMOTE_LINE: Phrase;
21
21
  /**
22
22
  * How much of a group chat's recent messages the deployment keeps as background for an @mention (core's
23
- * `GroupContext`, TEAMS_GROUP_CONTEXT_*), when that is on: the newest `messages`, none older than `hours`.
23
+ * `GroupContext`, PA_GROUP_CONTEXT_*), when that is on: the newest `messages`, none older than `hours`.
24
24
  */
25
25
  export interface GroupContextKept {
26
26
  readonly messages: number;
@@ -10,7 +10,7 @@ export interface ObserverDeps {
10
10
  readonly observe: ObserveRepository;
11
11
  readonly links: Pick<LinkRepository, "getKey">;
12
12
  readonly assistant: Pick<ClawAssistantPort, "observeScope" | "observe" | "observations" | "session" | "send">;
13
- /** Who may turn it on (TEAMS_OBSERVE_USERS, any case); empty: nobody. */
13
+ /** Who may turn it on (PA_OBSERVE_USERS, any case); empty: nobody. */
14
14
  readonly users: readonly string[];
15
15
  /** A conversation from the reference the store kept for a group (the channel's `ConversationRef.wire`). */
16
16
  readonly conversationOf: (wire: JsonObject) => Conversation;
@@ -1,11 +1,13 @@
1
1
  import type { ClawAssistantPort } from "./assistant.js";
2
2
  import type { ClawRemoteAgentsPort } from "./remote-agents.js";
3
3
  import type { ClawSessionsPort } from "./sessions.js";
4
+ import type { ClawSkillsPort } from "./skills.js";
4
5
  import type { ClawMergeConfirmationsPort, ClawNotificationsPort, ClawSettingsPort, ClawTriggersPort } from "./settings.js";
5
6
  import type { ClawWorkItemsPort } from "./work-items.js";
6
7
  export type * from "./assistant.js";
7
8
  export type * from "./remote-agents.js";
8
9
  export type * from "./sessions.js";
10
+ export type * from "./skills.js";
9
11
  export type * from "./settings.js";
10
12
  export type * from "./work-items.js";
11
13
  /**
@@ -25,4 +27,6 @@ export interface ClawPort {
25
27
  readonly triggers: ClawTriggersPort;
26
28
  readonly mergeConfirmations: ClawMergeConfirmationsPort;
27
29
  readonly remoteAgents: ClawRemoteAgentsPort;
30
+ /** The person's personal skills: `/skills`, and the buttons of a skill's card. */
31
+ readonly skills: ClawSkillsPort;
28
32
  }
@@ -0,0 +1,52 @@
1
+ import type { ClawCredential } from "../../claw/credential.js";
2
+ /** One of the person's personal skills as `/skills` lists it: the current version of each name, turned off ones included. */
3
+ export interface ClawSkillEntry {
4
+ readonly name: string;
5
+ readonly version: number;
6
+ readonly description: string;
7
+ readonly enabled: boolean;
8
+ /** `manual`: used only when the person names it. */
9
+ readonly invocation: "auto" | "manual";
10
+ /** Imported from someone else. */
11
+ readonly imported: boolean;
12
+ /** When a turn last read it (ISO), or "" never. */
13
+ readonly lastUsedAt: string;
14
+ readonly files: number;
15
+ }
16
+ /** One skill whole: SKILL.md and its files. */
17
+ export interface ClawSkill extends ClawSkillEntry {
18
+ readonly content: string;
19
+ readonly fileList: readonly {
20
+ readonly path: string;
21
+ readonly sizeBytes: number;
22
+ }[];
23
+ }
24
+ /** A change Claw made that the person can take back (`change_id`), and until when (ISO, "" not said). */
25
+ export interface ClawSkillChange {
26
+ readonly version: number | null;
27
+ readonly changed: boolean;
28
+ readonly changeId: string;
29
+ readonly undoExpiresAt: string;
30
+ }
31
+ /** What an undo did: `deleted`, `restored_version`, `restored`, `enabled` or `disabled`. */
32
+ export interface ClawSkillUndone {
33
+ readonly undone: string;
34
+ readonly name: string;
35
+ readonly version: number | null;
36
+ }
37
+ /**
38
+ * The person's personal skills (`/v1/users/me/skills`, `/v1/users/me/skill-changes`), always as that person. ClawError(404): no such
39
+ * skill, change or route (a Claw without them); ClawError(409/410): the change cannot be undone (`reason`, in the error's text).
40
+ */
41
+ export interface ClawSkillsPort {
42
+ list(key: ClawCredential): Promise<ClawSkillEntry[]>;
43
+ show(key: ClawCredential, name: string): Promise<ClawSkill>;
44
+ setEnabled(key: ClawCredential, name: string, enabled: boolean): Promise<ClawSkillChange>;
45
+ remove(key: ClawCredential, name: string): Promise<ClawSkillChange>;
46
+ /** Saves new text (and description) for one of the person's skills as its next version. */
47
+ update(key: ClawCredential, name: string, skill: {
48
+ readonly content: string;
49
+ readonly description: string;
50
+ }): Promise<ClawSkillChange>;
51
+ undo(key: ClawCredential, changeId: string): Promise<ClawSkillUndone>;
52
+ }
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Where the worker's secrets come from. The names are the settings they replace; how a source finds each one (an
3
- * environment variable, a mounted file, a vault entry) is that source's business.
2
+ * Where the worker's secrets come from. The names are the settings they first replaced, kept as stable ids; how a source
3
+ * finds each one (an environment variable, now under its `PA_` name, a mounted file, a vault entry) is that source's
4
+ * business.
4
5
  */
5
6
  export declare const SECRET_NAMES: readonly ["TEAMS_ENCRYPTION_KEYS", "TEAMS_EXCHANGE_CLIENT_SECRET", "FEEDBACK_GITHUB_APP_KEY"];
6
7
  export type SecretName = (typeof SECRET_NAMES)[number];
@@ -3,11 +3,11 @@ export declare const LINK_CODE_TTL_SECONDS: number;
3
3
  export declare const CODE_LENGTH = 8;
4
4
  /** The alphabet a link code is drawn from: no 0/O/1/I. */
5
5
  export declare const CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
6
- /** Wrong codes per user in the window (TEAMS_LINK_MAX_FAILURES_PER_USER). */
6
+ /** Wrong codes per user in the window (PA_LINK_MAX_FAILURES_PER_USER). */
7
7
  export declare const MAX_FAILED_ATTEMPTS = 5;
8
- /** Wrong codes of all users together in the window (TEAMS_LINK_MAX_FAILURES_GLOBAL). */
8
+ /** Wrong codes of all users together in the window (PA_LINK_MAX_FAILURES_GLOBAL). */
9
9
  export declare const MAX_FAILED_ATTEMPTS_GLOBAL = 100;
10
- /** TEAMS_LINK_ATTEMPT_WINDOW_SECONDS. */
10
+ /** PA_LINK_ATTEMPT_WINDOW_SECONDS. */
11
11
  export declare const ATTEMPT_WINDOW_SECONDS: number;
12
12
  /** An action is carried out for an assistant message this young, at most. */
13
13
  export declare const ASSISTANT_MESSAGE_KEEP_SECONDS: number;
@@ -62,12 +62,55 @@ export interface AssistantConfirmWrite {
62
62
  confirmation_id: string;
63
63
  /** The short id the person may type back. */
64
64
  ref: string;
65
- /** `devenv_send`: an instruction for an agent on the person's own machine (`assistant/devenv-tools.ts`). */
66
- kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide";
65
+ /**
66
+ * `devenv_send`: an instruction for an agent on the person's own machine (`assistant/devenv-tools.ts`). `skill_save`: a personal skill
67
+ * the assistant drafted on its own, saved only when the person lets it through (`assistant/skill-writes.ts`); its message carries
68
+ * `skill_card` with what would be saved.
69
+ */
70
+ kind: "trigger_create" | "trigger_cancel" | "github_comment" | "devenv_send" | "devenv_hide" | "skill_save";
67
71
  /** What the button that lets it through says, in the language of the text. */
68
72
  allow_label: string;
69
73
  expires_at: string;
70
74
  }
75
+ /**
76
+ * A personal skill as a message shows it (`assistant/skill-writes.ts`): what was just saved, changed, turned off or deleted at the
77
+ * person's request, or what the assistant drafted for them to confirm. The message's text says the same in words, for a channel that
78
+ * draws no card. Everything here is the person's own skill, so it goes only to their own conversation, never a group's.
79
+ *
80
+ * - `saved` (a skill created, or a new version of one), `deleted`, `disabled`, `enabled`: done already. `change_id` is what an Undo
81
+ * button takes back, `POST /v1/users/me/skill-changes/{change_id}/undo` made as the person, until `undo_expires_at`: a created skill
82
+ * is deleted again, an update goes back to the version before, a delete is restored, a turn off or on is turned back. An Edit
83
+ * button changes the skill as it is now (`GET` then `PUT /v1/users/me/skills/{name}`).
84
+ * - `draft`: nothing is saved yet. The message also carries `confirm_write` (kind `skill_save`); its two buttons are Save (`allow`)
85
+ * and Discard (`deny`) on that confirmation.
86
+ */
87
+ export interface AssistantSkillCard {
88
+ kind: "saved" | "deleted" | "disabled" | "enabled" | "draft";
89
+ name: string;
90
+ /** The version now (for `draft`, the version a save would make; null when not known). */
91
+ version: number | null;
92
+ /** `saved`: true for a new skill (or one brought back), false for a new version of one the person had. */
93
+ created?: boolean;
94
+ /** When to use it, in the person's words: what decides whether it is used without being named. */
95
+ description: string;
96
+ /** `manual`: used only when the person names it. */
97
+ invocation: "auto" | "manual";
98
+ files: Array<{
99
+ path: string;
100
+ size_bytes: number;
101
+ }>;
102
+ /** The first lines of SKILL.md (at most 30 lines and 1500 characters), for the card to show; empty for `deleted`. */
103
+ preview: string;
104
+ change_id?: string;
105
+ undo_expires_at?: string;
106
+ /** `draft`: the confirmation its Save and Discard answer, the same as `confirm_write.confirmation_id`. */
107
+ confirmation_id?: string;
108
+ /**
109
+ * `draft` shown where the user has no assistant (a session event of the chat a worker saved from): no confirmation, the draft itself,
110
+ * saved with `POST /v1/users/me/skill-drafts/{draft_id}/confirm` and dropped with `DELETE` on the same path.
111
+ */
112
+ draft_id?: string;
113
+ }
71
114
  /**
72
115
  * A file a work item's worker delivered (`deliver_file`, `deliver_text`), or one the router wrote (`deliver_text`), for a channel to
73
116
  * offer as a download. The download is Claw's own link, `GET /v1/sessions/{session_id}/deliveries/{id}`, which answers only the
@@ -179,6 +222,8 @@ export interface AssistantSayPayload extends AssistantEventBase {
179
222
  */
180
223
  choices?: AssistantSayChoice;
181
224
  confirm_write?: AssistantConfirmWrite;
225
+ /** A personal skill the message is about (`AssistantSkillCard`); present only with `CLAW_USER_SKILLS_ENABLED`. */
226
+ skill_card?: AssistantSkillCard;
182
227
  /** Files the user gets with the message (a worker's deliveries, `deliveries.ts`): one download each. */
183
228
  files?: AssistantFile[];
184
229
  /** Present on a development environment session's own message: which session, and which of its three kinds of news. */
@@ -91,7 +91,7 @@ export interface RemoteContext {
91
91
  digestHex(algorithm: "sha1" | "sha256", text: string): string;
92
92
  /** The language a person is answered in. */
93
93
  langOf(person: string): Lang;
94
- /** TEAMS_DIRECT_CHAT: whose 1:1 chat is the agent's window itself. */
94
+ /** PA_DIRECT_CHAT: whose 1:1 chat is the agent's window itself. */
95
95
  readonly directChat: DirectChat;
96
96
  }
97
97
  /**
@@ -40,7 +40,7 @@ export declare class FollowControl {
40
40
  private learn;
41
41
  shutdown(): void;
42
42
  /**
43
- * TEAMS_DIRECT_CHAT is on for this person: an attachment that still has the session card as its window is moved to the chat,
43
+ * PA_DIRECT_CHAT is on for this person: an attachment that still has the session card as its window is moved to the chat,
44
44
  * here and in the store, so nothing reads it as a card any more (the card itself is left where it is).
45
45
  */
46
46
  chatIsWindow(chatKey: string): void;
@@ -14,7 +14,7 @@ export declare class ChatState {
14
14
  attached(chatKey: string): RemoteState | null;
15
15
  /** The language the chat is answered in ("en" when it cannot be read). */
16
16
  lang(chatKey: string): Lang;
17
- /** TEAMS_DIRECT_CHAT is on for this 1:1 chat's person (a group binding keeps its session card). */
17
+ /** PA_DIRECT_CHAT is on for this 1:1 chat's person (a group binding keeps its session card). */
18
18
  directOn(chatKey: string): boolean;
19
19
  /** The chat is the agent's window itself, with no card. */
20
20
  direct(chatKey: string): boolean;
@@ -24,7 +24,7 @@ export declare function chatCredentialOf(links: Pick<LinkRepository, "getKey">,
24
24
  * What Claw is called with for a person, and what a person who has none is told (the Python `Agent._credential`,
25
25
  * `_unlinked`, `_connect_identity`, `_binding_card`, `_ask_to_link`, `_background_credential`, `_fresh_credential`).
26
26
  *
27
- * A chat runs on the person's linked key; with TEAMS_EXCHANGE_FOR_CHAT on, on a fresh exchanged token when they have a
27
+ * A chat runs on the person's linked key; with PA_EXCHANGE_FOR_CHAT on, on a fresh exchanged token when they have a
28
28
  * confirmed binding, else their linked key, else they get the card that binds them.
29
29
  */
30
30
  export declare class Credentials {