qlogicagent 2.1.0 → 2.3.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 (59) hide show
  1. package/dist/agent.js +10 -9
  2. package/dist/cli.js +227 -209
  3. package/dist/contracts.js +1 -1
  4. package/dist/index.js +226 -208
  5. package/dist/orchestration.js +13 -12
  6. package/dist/types/agent/constants.d.ts +4 -53
  7. package/dist/types/agent/tunable-defaults.d.ts +221 -0
  8. package/dist/types/agent/types.d.ts +3 -1
  9. package/dist/types/cli/stdio-server.d.ts +52 -1
  10. package/dist/types/cli/tool-bootstrap.d.ts +8 -0
  11. package/dist/types/contracts/index.d.ts +0 -1
  12. package/dist/types/contracts/todo.d.ts +8 -21
  13. package/dist/types/llm/adapters/aliyun-oss-file-upload-adapter.d.ts +44 -0
  14. package/dist/types/llm/adapters/gemini-file-upload-adapter.d.ts +26 -0
  15. package/dist/types/llm/adapters/hub-oss-file-upload-adapter.d.ts +29 -0
  16. package/dist/types/llm/adapters/index.d.ts +10 -0
  17. package/dist/types/llm/adapters/openai-file-upload-adapter.d.ts +38 -0
  18. package/dist/types/llm/adapters/volcengine-file-upload-adapter.d.ts +24 -0
  19. package/dist/types/llm/file-upload-service.d.ts +68 -0
  20. package/dist/types/llm/transports/anthropic-messages.d.ts +4 -0
  21. package/dist/types/llm/transports/gemini-generatecontent.d.ts +4 -0
  22. package/dist/types/llm/transports/media-resolve.d.ts +37 -12
  23. package/dist/types/llm/transports/openai-chat.d.ts +4 -0
  24. package/dist/types/llm/transports/openai-responses.d.ts +3 -0
  25. package/dist/types/llm/transports/volcengine-responses.d.ts +4 -0
  26. package/dist/types/orchestration/skill-improvement.d.ts +39 -8
  27. package/dist/types/orchestration/subagent/fork-subagent.d.ts +2 -2
  28. package/dist/types/orchestration/tool-loop/tool-schema.d.ts +1 -0
  29. package/dist/types/protocol/methods.d.ts +70 -0
  30. package/dist/types/protocol/notifications.d.ts +61 -0
  31. package/dist/types/runtime/execution/dream-category-context.d.ts +1 -1
  32. package/dist/types/runtime/hooks/memory-hooks.d.ts +0 -3
  33. package/dist/types/runtime/hooks/skill-recall-hooks.d.ts +2 -4
  34. package/dist/types/runtime/infra/agent-paths.d.ts +6 -0
  35. package/dist/types/runtime/infra/index.d.ts +3 -1
  36. package/dist/types/runtime/infra/media-persistence.d.ts +71 -0
  37. package/dist/types/runtime/infra/project-instructions-store.d.ts +30 -0
  38. package/dist/types/runtime/infra/project-plan-store.d.ts +27 -0
  39. package/dist/types/runtime/infra/project-store.d.ts +36 -0
  40. package/dist/types/runtime/infra/skill-injector.d.ts +9 -2
  41. package/dist/types/skills/index.d.ts +2 -4
  42. package/dist/types/skills/memory/categories.d.ts +5 -0
  43. package/dist/types/skills/memory/memdir.d.ts +6 -1
  44. package/dist/types/skills/memory/recall-category-filter.d.ts +1 -1
  45. package/dist/types/skills/permissions/group-security-policy.d.ts +15 -0
  46. package/dist/types/skills/permissions/index.d.ts +1 -0
  47. package/dist/types/skills/plugins/plugin-loader.d.ts +5 -0
  48. package/dist/types/skills/portable-tool.d.ts +13 -2
  49. package/dist/types/skills/skill-system/skill-source.d.ts +65 -0
  50. package/dist/types/skills/tools/plan-mode-tool.d.ts +1 -1
  51. package/dist/types/skills/tools/read-tool.d.ts +2 -2
  52. package/dist/types/skills/tools/task-tool.d.ts +64 -75
  53. package/dist/types/transport/acp-server.d.ts +2 -0
  54. package/package.json +1 -1
  55. package/dist/types/contracts/planner.d.ts +0 -35
  56. package/dist/types/orchestration/error-handling/failover-error.d.ts +0 -33
  57. package/dist/types/skills/memory/memory-write-gate.d.ts +0 -46
  58. package/dist/types/skills/memory/memory-write-hook.d.ts +0 -44
  59. package/dist/types/skills/todo-tool.d.ts +0 -72
@@ -9,12 +9,12 @@
9
9
  * 5. Depth control via in-memory counter (not DB-based)
10
10
  */
11
11
  import type { AgentDefinition } from "./agent-registry.js";
12
+ import { MAX_FORK_DEPTH } from "../../agent/tunable-defaults.js";
12
13
  /** Sentinel tag injected into fork children to prevent recursive forking. */
13
14
  export declare const FORK_SENTINEL_TAG = "<fork-child-context>";
14
15
  /** Placeholder text used for all tool_results in shared prefix (ensures byte-identical prefix). */
15
16
  export declare const FORK_PLACEHOLDER_RESULT = "Fork started \u2014 processing in background";
16
- /** Maximum fork depth for in-memory agents (CC: MAX_FORK_DEPTH). */
17
- export declare const MAX_FORK_DEPTH = 4;
17
+ export { MAX_FORK_DEPTH };
18
18
  export interface ForkContext {
19
19
  /** Parent's full message history (becomes shared prefix for cache). */
20
20
  parentMessages: unknown[];
@@ -38,5 +38,6 @@ export declare function buildToolResultMessage(callId: string, result: {
38
38
  payload?: unknown;
39
39
  error?: string;
40
40
  toolReferences?: string[];
41
+ imageUrls?: string[];
41
42
  }): Record<string, unknown>;
42
43
  export declare function cleanToolSchemaForGemini(schema: Record<string, unknown>): unknown;
@@ -302,6 +302,56 @@ export interface TasksCancelResult {
302
302
  ok: boolean;
303
303
  message: string;
304
304
  }
305
+ export type ProjectType = "default" | "personal" | "group";
306
+ export type ProjectStatus = "active" | "archived";
307
+ export interface ProjectInfo {
308
+ id: string;
309
+ name: string;
310
+ workspaceDir: string;
311
+ type: ProjectType;
312
+ status: ProjectStatus;
313
+ groupId?: string;
314
+ createdAt: string;
315
+ updatedAt: string;
316
+ }
317
+ export interface ProjectCreateParams {
318
+ name: string;
319
+ workspaceDir: string;
320
+ type?: ProjectType;
321
+ groupId?: string;
322
+ }
323
+ export interface ProjectCreateResult {
324
+ ok: boolean;
325
+ project: ProjectInfo;
326
+ }
327
+ export interface ProjectListParams {
328
+ }
329
+ export interface ProjectListResult {
330
+ projects: ProjectInfo[];
331
+ }
332
+ export interface ProjectDeleteParams {
333
+ projectId: string;
334
+ }
335
+ export interface ProjectDeleteResult {
336
+ ok: boolean;
337
+ switchedTo?: ProjectInfo;
338
+ }
339
+ export interface SessionSwitchProjectParams {
340
+ projectId?: string;
341
+ projectName?: string;
342
+ workspaceDir?: string;
343
+ }
344
+ export interface SessionSwitchProjectResult {
345
+ ok: boolean;
346
+ project: ProjectInfo;
347
+ }
348
+ export interface SessionGetStateParams {
349
+ }
350
+ export interface SessionGetStateResult {
351
+ sessionId: string;
352
+ activeProject: ProjectInfo | null;
353
+ projects: ProjectInfo[];
354
+ }
305
355
  export interface RpcMethodMap {
306
356
  "initialize": {
307
357
  params: InitializeParams;
@@ -484,6 +534,26 @@ export interface RpcMethodMap {
484
534
  params: undefined;
485
535
  result: ProductSummary[];
486
536
  };
537
+ "project.create": {
538
+ params: ProjectCreateParams;
539
+ result: ProjectCreateResult;
540
+ };
541
+ "project.list": {
542
+ params: ProjectListParams;
543
+ result: ProjectListResult;
544
+ };
545
+ "project.delete": {
546
+ params: ProjectDeleteParams;
547
+ result: ProjectDeleteResult;
548
+ };
549
+ "session.switchProject": {
550
+ params: SessionSwitchProjectParams;
551
+ result: SessionSwitchProjectResult;
552
+ };
553
+ "session.getState": {
554
+ params: SessionGetStateParams;
555
+ result: SessionGetStateResult;
556
+ };
487
557
  }
488
558
  /** All known RPC method names. */
489
559
  export type RpcMethod = keyof RpcMethodMap;
@@ -192,6 +192,16 @@ export interface TurnMediaProgressNotification {
192
192
  /** Provider id. */
193
193
  provider?: string;
194
194
  }
195
+ /** Media files auto-downloaded to local storage (~/.qlogicagent/media/). */
196
+ export interface TurnMediaPersistedNotification {
197
+ turnId: string;
198
+ files: Array<{
199
+ remoteUrl: string;
200
+ localPath: string;
201
+ bytes: number;
202
+ mimeType: string;
203
+ }>;
204
+ }
195
205
  /** Full todo list updated — enables DeerFlow-style todo panel sync. */
196
206
  export interface TurnTodosUpdatedNotification {
197
207
  turnId?: string;
@@ -279,6 +289,15 @@ export interface MemoryUpdatedNotification {
279
289
  /** Human-readable summary of what changed. */
280
290
  summary?: string;
281
291
  }
292
+ /** Emitted when importance decay runs after a Dream consolidation. */
293
+ export interface MemoryDecayCompletedNotification {
294
+ /** Number of memories whose importance was reduced. */
295
+ decayed: number;
296
+ /** Number of memories archived (below threshold). */
297
+ archived: number;
298
+ /** Duration in ms. */
299
+ durationMs: number;
300
+ }
282
301
  /** Session metadata changed (title, model, etc.). */
283
302
  export interface SessionInfoNotification {
284
303
  sessionId: string;
@@ -407,6 +426,40 @@ export interface ProductCompletedNotification {
407
426
  productId: string;
408
427
  summary: string;
409
428
  }
429
+ /** A project was created. */
430
+ export interface ProjectCreatedNotification {
431
+ id: string;
432
+ name: string;
433
+ workspaceDir: string;
434
+ type: string;
435
+ groupId?: string;
436
+ }
437
+ /** Active project was switched. */
438
+ export interface ProjectSwitchedNotification {
439
+ id: string;
440
+ name: string;
441
+ workspaceDir: string;
442
+ }
443
+ /** A project was deleted. */
444
+ export interface ProjectDeletedNotification {
445
+ id: string;
446
+ }
447
+ /** A project was renamed. */
448
+ export interface ProjectRenamedNotification {
449
+ id: string;
450
+ name: string;
451
+ workspaceDir: string;
452
+ }
453
+ /** A project was archived. */
454
+ export interface ProjectArchivedNotification {
455
+ id: string;
456
+ }
457
+ /** A project was unarchived (restored). */
458
+ export interface ProjectUnarchivedNotification {
459
+ id: string;
460
+ name: string;
461
+ workspaceDir: string;
462
+ }
410
463
  export interface NotificationMethodMap {
411
464
  "turn.start": TurnStartNotification;
412
465
  "turn.delta": TurnDeltaNotification;
@@ -425,6 +478,7 @@ export interface NotificationMethodMap {
425
478
  "turn.annotations": TurnAnnotationsNotification;
426
479
  "turn.media_result": TurnMediaResultNotification;
427
480
  "turn.media_progress": TurnMediaProgressNotification;
481
+ "turn.media_persisted": TurnMediaPersistedNotification;
428
482
  "turn.todos_updated": TurnTodosUpdatedNotification;
429
483
  "task.updated": TaskUpdatedNotification;
430
484
  "turn.exec_progress": TurnExecProgressNotification;
@@ -435,6 +489,7 @@ export interface NotificationMethodMap {
435
489
  "turn.skill_instruction": TurnSkillInstructionNotification;
436
490
  "turn.ask_user": TurnAskUserNotification;
437
491
  "memory.updated": MemoryUpdatedNotification;
492
+ "memory.decay.completed": MemoryDecayCompletedNotification;
438
493
  "session.info": SessionInfoNotification;
439
494
  "permission.rule_updated": PermissionRuleUpdatedNotification;
440
495
  "team.updated": TeamUpdatedNotification;
@@ -453,6 +508,12 @@ export interface NotificationMethodMap {
453
508
  "product.checkpointed": ProductCheckpointedNotification;
454
509
  "product.budgetWarning": ProductBudgetWarningNotification;
455
510
  "product.completed": ProductCompletedNotification;
511
+ "project.created": ProjectCreatedNotification;
512
+ "project.switched": ProjectSwitchedNotification;
513
+ "project.deleted": ProjectDeletedNotification;
514
+ "project.renamed": ProjectRenamedNotification;
515
+ "project.archived": ProjectArchivedNotification;
516
+ "project.unarchived": ProjectUnarchivedNotification;
456
517
  }
457
518
  /** All known notification method names. */
458
519
  export type NotificationMethod = keyof NotificationMethodMap;
@@ -1,4 +1,4 @@
1
- import type { QMemoryCategory } from "../../skills/memory/memory-write-gate.js";
1
+ import type { QMemoryCategory } from "../../skills/memory/categories.js";
2
2
  /** A memory file with its inferred category and metadata. */
3
3
  export interface CategorizedMemoryFile {
4
4
  filename: string;
@@ -2,11 +2,8 @@ import type { HookRegistry } from "../../contracts/hooks.js";
2
2
  import type { MemoryProvider } from "qlogicagent-runtime-contracts";
3
3
  import type { Memdir } from "../../skills/memory/memdir.js";
4
4
  export declare const MEMORY_PREFETCH_CONFIG: {
5
- /** Max bytes of memory content to inject per session (CC: 60KB) */
6
5
  readonly MAX_SESSION_BYTES: number;
7
- /** Max results per recall query */
8
6
  readonly LIMIT_PER_RECALL: 10;
9
- /** Max entries in surfaced-path LRU set */
10
7
  readonly MAX_SURFACED_ENTRIES: 100;
11
8
  };
12
9
  export interface MemoryHooksDeps {
@@ -1,14 +1,12 @@
1
1
  import type { HookRegistry } from "../../contracts/hooks.js";
2
2
  export declare const SKILL_RECALL_CONFIG: {
3
- /** Max number of cross-project skills to inject per turn. */
4
3
  readonly MAX_RECALLED_SKILLS: 3;
5
- /** Max chars of skill content to include in recall context. */
6
4
  readonly MAX_SKILL_CONTENT_CHARS: 800;
7
- /** Cache TTL for known project skill index (ms). */
8
5
  readonly CACHE_TTL_MS: number;
9
6
  };
10
7
  /**
11
- * Detect whether user message contains retrospective/cross-reference semantics.
8
+ * Detect whether user message contains retrospective/cross-reference semantics
9
+ * OR similar-task patterns that could benefit from existing skills.
12
10
  * Returns extracted keywords for skill matching if triggered, or null.
13
11
  */
14
12
  export declare function detectRetrospectiveTrigger(message: string): string[] | null;
@@ -39,6 +39,8 @@ export declare function getUserWorkflowsDir(): string;
39
39
  export declare function getUserInstructionsPath(): string;
40
40
  /** `~/.qlogicagent/rules/` */
41
41
  export declare function getUserRulesDir(): string;
42
+ /** `~/.qlogicagent/media/` — auto-downloaded media files (images, videos, audio). */
43
+ export declare function getUserMediaDir(): string;
42
44
  /** `<cwd>/.qlogicagent/` */
43
45
  export declare function getProjectAgentDir(cwd?: string): string;
44
46
  /** `<cwd>/.qlogicagent/workflows/` */
@@ -51,6 +53,10 @@ export declare function getProjectSkillsDir(cwd?: string): string;
51
53
  export declare function getProjectSettingsPath(cwd?: string): string;
52
54
  /** `<cwd>/.qlogicagent/INSTRUCTIONS.md` */
53
55
  export declare function getProjectInstructionsPath(cwd?: string): string;
56
+ /** `<cwd>/.qlogicagent/instructions/` — project-scoped instruction files (CRUD via RPC) */
57
+ export declare function getProjectInstructionsDir(cwd?: string): string;
58
+ /** `<cwd>/.qlogicagent/plans/` — project-scoped plan files */
59
+ export declare function getProjectPlansDir(cwd?: string): string;
54
60
  /** `<cwd>/.qlogicagent/rules/` */
55
61
  export declare function getProjectRulesDir(cwd?: string): string;
56
62
  /** `<cwd>/.qlogicagent/sessions/` */
@@ -1,6 +1,8 @@
1
- export { AGENT_DOT_DIR, getUserAgentHome, getUserSessionDir, getUserCredentialsPath, getUserPluginsDir, getUserSkillsDir, getUserSettingsPath, getUserCacheDir, getUserDebugLogsDir, getUserCheckpointsDir, getUserPluginCacheDir, getUserMcpConfigPath, getUserMarketplaceConfigPath, getUserWorkflowsDir, getUserInstructionsPath, getProjectAgentDir, getProjectWorkflowsDir, getProjectPluginsDir, getProjectSkillsDir, getProjectSettingsPath, getProjectInstructionsPath, getProjectRulesDir, getGitRootHooksDir, getKnownProjectDirs, getAllProjectSkillDirs, } from "./agent-paths.js";
1
+ export { AGENT_DOT_DIR, getUserAgentHome, getUserSessionDir, getUserCredentialsPath, getUserPluginsDir, getUserSkillsDir, getUserSettingsPath, getUserCacheDir, getUserDebugLogsDir, getUserCheckpointsDir, getUserPluginCacheDir, getUserMcpConfigPath, getUserMarketplaceConfigPath, getUserWorkflowsDir, getUserInstructionsPath, getProjectAgentDir, getProjectWorkflowsDir, getProjectPluginsDir, getProjectSkillsDir, getProjectSettingsPath, getProjectInstructionsPath, getProjectInstructionsDir, getProjectPlansDir, getProjectRulesDir, getGitRootHooksDir, getKnownProjectDirs, getAllProjectSkillDirs, } from "./agent-paths.js";
2
2
  export { getBudgetContinuationMessage } from "./token-budget.js";
3
3
  export { type SecureStorage, saveApiKey, loadApiKey } from "./secure-storage.js";
4
+ export { ProjectInstructionsStore, type InstructionFile } from "./project-instructions-store.js";
5
+ export { ProjectPlanStore, type PlanEntry } from "./project-plan-store.js";
4
6
  export { createFileWatcher, FileWatcher } from "./file-watcher.js";
5
7
  export { TaskStore } from "./task-runtime.js";
6
8
  export { createWorktreeBackend } from "./worktree-backend.js";
@@ -0,0 +1,71 @@
1
+ /**
2
+ * MediaPersistence — Auto-download generated media to local storage.
3
+ *
4
+ * When LLM tools generate files (images, videos, audio) and return
5
+ * cloud URLs, this service downloads them to a persistent local directory
6
+ * so the user can access them offline without manual intervention.
7
+ *
8
+ * Storage layout:
9
+ * ~/.qlogicagent/media/
10
+ * ├── <session-or-date>/
11
+ * │ ├── image_20260520_143022_abc.png
12
+ * │ ├── video_20260520_143055_def.mp4
13
+ * │ └── audio_20260520_143100_ghi.mp3
14
+ *
15
+ * Integration:
16
+ * Called from the tool result pipeline in tool-loop.ts.
17
+ * When a tool result's `details.mediaUrls` contains URLs,
18
+ * each URL is downloaded and the local path is added to details.
19
+ */
20
+ export interface MediaDownloadResult {
21
+ /** Original cloud URL. */
22
+ remoteUrl: string;
23
+ /** Local file path after download. */
24
+ localPath: string;
25
+ /** File size in bytes. */
26
+ bytes: number;
27
+ /** MIME type (from Content-Type header). */
28
+ mimeType: string;
29
+ }
30
+ export interface MediaPersistenceConfig {
31
+ /**
32
+ * Project working directory. When set, media downloads to `{projectDir}/media/`.
33
+ * Takes precedence over `mediaDir`. This is the preferred approach — generated
34
+ * media files belong to the project, not the global user home.
35
+ */
36
+ projectDir?: string;
37
+ /** Base directory for media storage. Default: ~/.qlogicagent/media/ (fallback only). */
38
+ mediaDir?: string;
39
+ /** Maximum file size to download (bytes). Default: 500MB. */
40
+ maxFileSize?: number;
41
+ /** Download timeout per file (ms). Default: 300_000 (5 min). */
42
+ timeoutMs?: number;
43
+ }
44
+ export declare class MediaPersistence {
45
+ private mediaDir;
46
+ private readonly maxFileSize;
47
+ private readonly timeoutMs;
48
+ constructor(config?: MediaPersistenceConfig);
49
+ /** Update media directory to use a specific project root. */
50
+ setProjectDir(projectDir: string): void;
51
+ /**
52
+ * Download a remote URL to local storage.
53
+ * Returns the local file path and metadata.
54
+ */
55
+ download(remoteUrl: string, hint?: {
56
+ type?: string;
57
+ sessionId?: string;
58
+ }): Promise<MediaDownloadResult>;
59
+ /**
60
+ * Download multiple URLs. Returns results for successful downloads.
61
+ * Failed downloads are logged but don't throw.
62
+ */
63
+ downloadAll(urls: string[], hint?: {
64
+ type?: string;
65
+ sessionId?: string;
66
+ }, log?: {
67
+ warn: (msg: string) => void;
68
+ }): Promise<MediaDownloadResult[]>;
69
+ /** Get the base media directory path. */
70
+ getMediaDir(): string;
71
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ProjectInstructionsStore — CRUD for project-scoped instruction files.
3
+ *
4
+ * Storage location: `<workspace>/.qlogicagent/instructions/*.md`
5
+ * Format matches Gateway's InstructionsStore output for seamless migration.
6
+ */
7
+ export interface InstructionFile {
8
+ filename: string;
9
+ content: string;
10
+ sizeBytes: number;
11
+ }
12
+ export declare class ProjectInstructionsStore {
13
+ private dir;
14
+ constructor(cwd: string);
15
+ /** List all instruction files for the project. */
16
+ list(): InstructionFile[];
17
+ /** Read a single instruction file. */
18
+ read(filename: string): InstructionFile | null;
19
+ /** Write (create or update) an instruction file. */
20
+ write(filename: string, content: string): InstructionFile;
21
+ /** Delete an instruction file. */
22
+ remove(filename: string): boolean;
23
+ /**
24
+ * Load all instruction files and concatenate into a single block
25
+ * for agent system context injection.
26
+ */
27
+ loadAll(): string;
28
+ private isValidFilename;
29
+ private getDirSize;
30
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * ProjectPlanStore — CRUD for project-scoped plan files.
3
+ *
4
+ * Storage location: `<workspace>/.qlogicagent/plans/*.md`
5
+ * Each plan is a markdown file with YAML frontmatter (slug, status, timestamps).
6
+ */
7
+ export interface PlanEntry {
8
+ slug: string;
9
+ status: "active" | "completed" | "abandoned";
10
+ content: string;
11
+ createdAt: string;
12
+ updatedAt: string;
13
+ }
14
+ export declare class ProjectPlanStore {
15
+ private dir;
16
+ constructor(cwd: string);
17
+ /** List all plans. */
18
+ list(): PlanEntry[];
19
+ /** Load active plans only. */
20
+ loadActive(): PlanEntry[];
21
+ /** Load a single plan by slug. */
22
+ load(slug: string): PlanEntry | null;
23
+ /** Save or update a plan. */
24
+ save(slug: string, content: string): void;
25
+ /** Delete a plan. */
26
+ remove(slug: string): boolean;
27
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Local Project Store — persists project metadata to ~/.qlogicagent/projects.json.
3
+ *
4
+ * This is the Agent-side (runtime authority) project registry.
5
+ * Hub maintains a mirror copy via EventBus → HubSubscriber → hub.persistProject.
6
+ *
7
+ * Direction A: Agent is the source of truth for project state.
8
+ */
9
+ import type { ProjectInfo, ProjectType } from "../../protocol/methods.js";
10
+ export declare function createProject(params: {
11
+ name: string;
12
+ workspaceDir: string;
13
+ type?: ProjectType;
14
+ groupId?: string;
15
+ }): ProjectInfo;
16
+ export declare function listProjects(): ProjectInfo[];
17
+ export declare function getActiveProject(): ProjectInfo | null;
18
+ export declare function getProjectById(projectId: string): ProjectInfo | null;
19
+ export declare function switchProject(projectId: string): ProjectInfo | null;
20
+ export declare function deleteProject(projectId: string): {
21
+ deleted: boolean;
22
+ switchedTo?: ProjectInfo;
23
+ };
24
+ export declare function getOrCreateDefaultProject(defaultWorkspaceDir: string): ProjectInfo;
25
+ export declare function renameProject(projectId: string, newName: string): ProjectInfo | null;
26
+ export declare function archiveProject(projectId: string): {
27
+ archived: boolean;
28
+ switchedTo?: ProjectInfo;
29
+ };
30
+ export declare function unarchiveProject(projectId: string): ProjectInfo | null;
31
+ export declare function findByGroupId(groupId: string): ProjectInfo | null;
32
+ export declare function archiveByGroupId(groupId: string): {
33
+ archived: boolean;
34
+ projectId?: string;
35
+ switchedTo?: ProjectInfo;
36
+ };
@@ -9,8 +9,11 @@
9
9
  *
10
10
  * 2. **First-message prompt injection**: For agents without native skill
11
11
  * directory support, prepend skill instructions text to the first prompt.
12
+ * Subject to a token budget to prevent context bloat.
12
13
  */
13
14
  import type { AgentCapabilities } from "./acp-types.js";
15
+ import { SKILL_INJECTION_MAX_CHARS, SKILL_INJECTION_MAX_COUNT } from "../../agent/tunable-defaults.js";
16
+ export { SKILL_INJECTION_MAX_CHARS, SKILL_INJECTION_MAX_COUNT };
14
17
  export declare class SkillInjector {
15
18
  /**
16
19
  * Synchronize skills to an agent's native skill directory.
@@ -24,6 +27,9 @@ export declare class SkillInjector {
24
27
  * Build a skill description block to prepend to the first message
25
28
  * for agents that don't support native skill directories.
26
29
  *
30
+ * Respects SKILL_INJECTION_MAX_CHARS and SKILL_INJECTION_MAX_COUNT
31
+ * to prevent token bloat.
32
+ *
27
33
  * @param cwd - Project working directory (for project-level skills)
28
34
  * @returns Markdown text with skill instructions, or empty string if no skills.
29
35
  */
@@ -44,8 +50,9 @@ export declare class SkillInjector {
44
50
  */
45
51
  applySkills(capabilities?: AgentCapabilities, cwd?: string): string;
46
52
  /**
47
- * Collect all skill file paths from user-level and project-level dirs.
48
- * Only `.md` files are treated as skills.
53
+ * Collect all skill file paths from project-level and user-level dirs.
54
+ * Skills are stored as `<dir>/<skillName>/SKILL.md`.
55
+ * Priority: project > global (project listed first for budget-constrained injection).
49
56
  */
50
57
  private collectSkillPaths;
51
58
  }
@@ -8,8 +8,6 @@ export { createQMemoryAdapter } from "./memory/qmemory-adapter.js";
8
8
  export type { QMemoryAdapterConfig, QMemoryHealthStatus, ExtractedMemoryItem, DecayOptions, DecayResult } from "./memory/qmemory-adapter.js";
9
9
  export { THINK_TOOL_NAME, THINK_TOOL_SCHEMA, createThinkTool } from "./think-tool.js";
10
10
  export type { ThinkToolParams } from "./think-tool.js";
11
- export { TODO_TOOL_NAME, TODO_TOOL_SCHEMA, TODO_ACTIONS, createTodoTool } from "./todo-tool.js";
12
- export type { TodoToolParams, TodoToolOptions, TodoAction } from "./todo-tool.js";
13
11
  export { READ_TOOL_NAME, READ_TOOL_SCHEMA, createReadTool } from "./tools/read-tool.js";
14
12
  export type { ReadToolParams, ReadToolDeps, ReadResultType } from "./tools/read-tool.js";
15
13
  export { WRITE_TOOL_NAME, WRITE_TOOL_SCHEMA, createWriteTool } from "./tools/write-tool.js";
@@ -54,8 +52,8 @@ export { PATCH_TOOL_NAME, PATCH_TOOL_SCHEMA, createPatchTool, fuzzyFind } from "
54
52
  export type { PatchToolParams, PatchToolDeps, PatchResult, MatchStrategy, MatchResult } from "./tools/patch-tool.js";
55
53
  export { AGENT_TOOL_NAME, AGENT_TOOL_SCHEMA, createAgentTool } from "./tools/agent-tool.js";
56
54
  export type { AgentToolParams, AgentToolDeps, AgentResult } from "./tools/agent-tool.js";
57
- export { TASK_TOOL_NAME, TASK_TOOL_SCHEMA, createTaskTool } from "./tools/task-tool.js";
58
- export type { TaskToolParams, TaskToolDeps, TaskInfo, TaskResult, TaskAction, TaskStatus } from "./tools/task-tool.js";
55
+ export { TASK_TOOL_NAME, TASK_TOOL_SCHEMA, TASK_ACTIONS, createTaskTool, summarizeTaskList } from "./tools/task-tool.js";
56
+ export type { TaskToolParams, TaskToolOptions, TaskToolHooks, TaskItem, TaskListSummary, TaskAction, TaskStatus } from "./tools/task-tool.js";
59
57
  export { REPL_TOOL_NAME, REPL_TOOL_SCHEMA, REPL_HIDES_TOOLS, createReplTool } from "./tools/repl-tool.js";
60
58
  export type { ReplToolParams, ReplToolDeps, ReplPrimitives, ReplExecResult } from "./tools/repl-tool.js";
61
59
  export { BROWSER_TOOL_NAME, BROWSER_TOOL_SCHEMA, createBrowserTool } from "./tools/browser-tool.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Memory categories for QMemory writes.
3
+ * Each has different value thresholds and retention policies.
4
+ */
5
+ export type QMemoryCategory = "lesson" | "preference" | "pattern" | "fact" | "decision" | "skill-learning";
@@ -57,8 +57,13 @@ export declare class Memdir {
57
57
  listFiles(): Promise<MemdirFileInfo[]>;
58
58
  /** Create a new topic file. Fails if it already exists. */
59
59
  createFile(name: string, content: string): Promise<MemdirResult>;
60
- /** Write/overwrite a topic file. */
60
+ /** Write/overwrite a topic file. Auto-splits if content > 8KB. */
61
61
  writeFile(name: string, content: string): Promise<MemdirResult>;
62
+ /**
63
+ * Auto-split: write oversized content into numbered part files.
64
+ * e.g. "lesson-docker.md" → "lesson-docker-1.md", "lesson-docker-2.md"
65
+ */
66
+ private writeFileSplit;
62
67
  /** Read a topic file. */
63
68
  readFile(name: string): Promise<{
64
69
  ok: boolean;
@@ -1,4 +1,4 @@
1
- import type { QMemoryCategory } from "../../skills/memory/memory-write-gate.js";
1
+ import type { QMemoryCategory } from "./categories.js";
2
2
  /** Detected query scenario with preferred categories. */
3
3
  export interface RecallCategoryHint {
4
4
  /** Detected scenario label. */
@@ -0,0 +1,15 @@
1
+ import type { PermissionRuleEntry } from "./types.js";
2
+ /**
3
+ * File path patterns considered sensitive — reading/writing these
4
+ * is blocked in group sessions. Used by the file access guard.
5
+ */
6
+ export declare const GROUP_SENSITIVE_FILE_PATTERNS: readonly RegExp[];
7
+ /**
8
+ * Returns the set of permission rules to inject for group sessions.
9
+ * These should be prepended to the rule engine (first-match wins).
10
+ */
11
+ export declare function getGroupSecurityRules(): PermissionRuleEntry[];
12
+ /**
13
+ * Checks if a file path matches sensitive patterns blocked in group mode.
14
+ */
15
+ export declare function isGroupSensitivePath(filePath: string): boolean;
@@ -9,4 +9,5 @@ export { ClassifierCache } from "./classifier-cache.js";
9
9
  export type { CachedClassification } from "./classifier-cache.js";
10
10
  export { watchSettings, loadInitialSettings } from "./settings-watcher.js";
11
11
  export type { SettingsFile, SettingsWatcherDeps } from "./settings-watcher.js";
12
+ export { getGroupSecurityRules, isGroupSensitivePath } from "./group-security-policy.js";
12
13
  export type { PermissionMode, PermissionBehavior, PermissionResult, PermissionRuleEntry, PermissionConfig, PermissionUpdate, PermissionDecisionReason, ToolPermissionCheckInput, ApprovalRequest, ApprovalResponse, } from "./types.js";
@@ -32,6 +32,11 @@ export declare class PluginLoader {
32
32
  * Get list of all loaded plugins.
33
33
  */
34
34
  getLoaded(): LoadedPlugin[];
35
+ /**
36
+ * Discover and load NEW plugins that weren't present during initial loadAll().
37
+ * Call per-turn to pick up newly-created skill directories (铁律 #16).
38
+ */
39
+ discoverNew(): Promise<number>;
35
40
  /**
36
41
  * Re-check activation for plugins whose TTL has expired.
37
42
  * Call this before tool resolution or periodically in the agent loop.
@@ -5,7 +5,12 @@
5
5
  export interface ToolContentBlock {
6
6
  type: "text" | "image";
7
7
  text?: string;
8
- /** base64-encoded image data (only when type === "image") */
8
+ /**
9
+ * base64-encoded image data (only when type === "image").
10
+ * Used by browser screenshots and MCP tools where data is already in memory.
11
+ * The tool invoker promotes these to data-URL imageUrls for transport resolution.
12
+ * For file-based images, prefer returning localPath via PortableToolResult.imageUrls.
13
+ */
9
14
  data?: string;
10
15
  mimeType?: string;
11
16
  }
@@ -16,6 +21,12 @@ export interface PortableToolResult {
16
21
  content: ToolContentBlock[];
17
22
  /** Arbitrary structured metadata for the calling runtime. */
18
23
  details?: Record<string, unknown>;
24
+ /**
25
+ * Local image file paths produced by this tool (e.g. read tool reading an image).
26
+ * Transport layer resolves these via FileUploadAdapter before sending to the LLM.
27
+ * This avoids loading large files into memory as base64.
28
+ */
29
+ imageUrls?: string[];
19
30
  }
20
31
  /**
21
32
  * A runtime-agnostic tool definition.
@@ -23,7 +34,7 @@ export interface PortableToolResult {
23
34
  * @typeParam TParams The expected parameter shape (for TypeScript consumers).
24
35
  */
25
36
  export interface PortableTool<TParams = Record<string, unknown>> {
26
- /** Unique tool name (e.g. "think", "todo", "memory"). */
37
+ /** Unique tool name (e.g. "think", "task", "memory"). */
27
38
  name: string;
28
39
  /** Human-readable label. */
29
40
  label: string;