@ai-ecoverse/slicc-agent 6.3.2 → 6.4.1

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.
@@ -1,7 +1,13 @@
1
- import type { Context } from '@earendil-works/chord';
1
+ import { type Context, type ReplicatedState } from '@earendil-works/chord';
2
+ import { type EntryDraft } from '@earendil-works/pi-durable';
2
3
  import type { ExecutionEnv } from '@earendil-works/pi-durable/env';
3
- import { type Manifest } from './v6-schema.ts';
4
- import { type ZipEntry } from './zip.ts';
4
+ import { type Agents, type AgentsState } from '../agents.ts';
5
+ import type { KernelUsers } from '../kernel/users.ts';
6
+ import type { Layout } from '../layout.ts';
7
+ import { type Licks, type Manifest, type Transcript, type V6Conversation } from './v6-schema.ts';
8
+ import { type ZipEntry, type ZipSource } from './zip.ts';
9
+ export declare const V6_KIND = "slicc.v6";
10
+ export declare const IMPORTS_DIR = "/var/lib/slicc/agent/imports";
5
11
  export declare const LIMITS: {
6
12
  archive: number;
7
13
  entries: number;
@@ -10,6 +16,12 @@ export declare const LIMITS: {
10
16
  total: number;
11
17
  ratio: number;
12
18
  };
19
+ export type ImportProgress = {
20
+ phase: 'idle' | 'checking' | 'writing' | 'done' | 'failed';
21
+ done: number;
22
+ total: number;
23
+ text: string;
24
+ };
13
25
  export interface ImportPreview {
14
26
  exportId: string;
15
27
  origin: string;
@@ -24,17 +36,36 @@ export interface ImportPreview {
24
36
  flagged: number;
25
37
  providers: string[];
26
38
  mounts: string[];
39
+ already: number | null;
27
40
  text: string;
28
41
  }
42
+ export interface ImportResult {
43
+ done: boolean;
44
+ preview: ImportPreview | null;
45
+ cones: string[];
46
+ report: string | null;
47
+ text: string;
48
+ error: string | null;
49
+ }
29
50
  export type ImportSource = {
30
51
  path: string;
31
52
  } | {
32
53
  bytes: Uint8Array;
33
54
  };
55
+ export interface ImportDeps {
56
+ agents: Agents;
57
+ env: ExecutionEnv;
58
+ layout: Layout;
59
+ users?: Pick<KernelUsers, 'add' | 'remove'>;
60
+ envOf?: (cone: string) => Promise<ExecutionEnv | undefined>;
61
+ opfs?: () => Promise<FileSystemDirectoryHandle>;
62
+ room?: () => Promise<number | undefined>;
63
+ now?: () => number;
64
+ }
34
65
  export type Opened = {
35
66
  manifest: Manifest;
36
67
  entries: Map<string, ZipEntry>;
37
- bytes: Uint8Array;
68
+ source: ZipSource;
38
69
  key: string;
39
70
  };
40
71
  export type Where = {
@@ -44,9 +75,50 @@ export type Where = {
44
75
  folder: string;
45
76
  rest: string;
46
77
  };
78
+ export type Scoop = {
79
+ name: string;
80
+ six: string | null;
81
+ folder: string;
82
+ conversation?: V6Conversation;
83
+ };
84
+ export type Unit = {
85
+ key: string;
86
+ name: string;
87
+ title: string;
88
+ six: string | null;
89
+ memory: string | null;
90
+ doc?: Transcript;
91
+ main?: V6Conversation;
92
+ scoops: Scoop[];
93
+ frozenAt: number;
94
+ tail: string;
95
+ cone: string;
96
+ fresh: boolean;
97
+ record: boolean;
98
+ suffix: string;
99
+ home: string;
100
+ roots: Set<string>;
101
+ files: Map<string, string>;
102
+ };
103
+ export type Parsed = {
104
+ data: Map<string, Uint8Array>;
105
+ licks: Licks;
106
+ units: Unit[];
107
+ };
47
108
  export declare const day: (at: number | string) => string;
48
109
  export declare function textOf(bytes: Uint8Array, name: string): string;
49
110
  export declare function whereOf(manifest: Manifest, name: string): Where;
50
- export declare function openProfile(bytes: Uint8Array): Promise<Opened>;
51
- export declare function previewOf(opened: Opened): Promise<ImportPreview>;
52
- export declare function checkProfile(env: ExecutionEnv, source: ImportSource, context: Context): Promise<ImportPreview>;
111
+ export declare function openProfile(source: ZipSource): Promise<Opened>;
112
+ export declare function previewOf(opened: Opened, state: Readonly<AgentsState>): Promise<ImportPreview>;
113
+ export declare function unitsOf(manifest: Manifest, data: Map<string, Uint8Array>): Unit[];
114
+ export declare function entriesOf(conversation: V6Conversation | undefined, files: Map<string, string>): EntryDraft[];
115
+ export interface Importer {
116
+ readonly progress: ReplicatedState<ImportProgress>;
117
+ run(source: ImportSource, options: {
118
+ again?: boolean;
119
+ preview?: boolean;
120
+ }, context: Context): Promise<ImportResult>;
121
+ cancel(): void;
122
+ }
123
+ export declare const IDLE: ImportProgress;
124
+ export declare function createImporter(deps: ImportDeps): Importer;
@@ -9,6 +9,12 @@ export type ZipEntry = {
9
9
  offset: number;
10
10
  mode: number;
11
11
  };
12
- export declare function zipEntries(bytes: Uint8Array): ZipEntry[];
12
+ export interface ZipSource {
13
+ readonly size: number;
14
+ read(offset: number, length: number): Promise<Uint8Array>;
15
+ }
16
+ export declare function bytesSource(bytes: Uint8Array): ZipSource;
17
+ export declare function blobSource(blob: Blob): ZipSource;
18
+ export declare function zipEntries(source: ZipSource): Promise<ZipEntry[]>;
13
19
  export declare function isLink(entry: ZipEntry): boolean;
14
- export declare function readEntry(bytes: Uint8Array, entry: ZipEntry): Promise<Uint8Array>;
20
+ export declare function readEntry(source: ZipSource, entry: ZipEntry): Promise<Uint8Array>;
@@ -12,6 +12,7 @@ export declare const SCOOP_USER = "scoop-";
12
12
  export declare function scoopUser(folder: string): string;
13
13
  export declare function homeOf(user: string): string;
14
14
  export declare function userOf(state: Readonly<AgentsState>, agentId: string): string | undefined;
15
+ export declare function coneSpec(cone: string): UserSpec;
15
16
  export type Wanted = {
16
17
  agentId: string;
17
18
  cone: string | null;
@@ -6,4 +6,6 @@ export interface PoolAccess {
6
6
  }
7
7
  export declare function vfsName(directory: string): string;
8
8
  export declare function holdLock(locks: LockManager, name: string): Promise<() => void>;
9
+ export declare function opfsDirectory(root: FileSystemDirectoryHandle, path: string): Promise<FileSystemDirectoryHandle | undefined>;
10
+ export declare function opfsFile(path: string, root?: () => Promise<FileSystemDirectoryHandle>): Promise<File | undefined>;
9
11
  export declare function settlePool(directory: string, access?: PoolAccess): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-agent",
3
- "version": "6.3.2",
3
+ "version": "6.4.1",
4
4
  "description": "SLICC's agent core on pi durable: an agent worker, session storage, remoting and pi extensions",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -63,10 +63,10 @@
63
63
  "release": "semantic-release"
64
64
  },
65
65
  "devDependencies": {
66
- "@ai-ecoverse/slicc-kernel": "1.125.5",
66
+ "@ai-ecoverse/slicc-kernel": "1.125.12",
67
67
  "@ai-ecoverse/slicc-scrub": "1.0.0",
68
68
  "@ai-ecoverse/slicc-shared-web": "1.24.2",
69
- "@ai-ecoverse/slicc-spectrum": "1.86.6",
69
+ "@ai-ecoverse/slicc-spectrum": "1.87.0",
70
70
  "@ai-ecoverse/wasm-bash": "5.3.0-20",
71
71
  "@ai-ecoverse/wasm-coreutils": "9.12.0-10",
72
72
  "@ai-ecoverse/wasm-git": "2.55.0-17",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@ai-ecoverse/slicc-browsers": "1.8.5",
86
- "@ai-ecoverse/slicc-vault": "1.10.0",
86
+ "@ai-ecoverse/slicc-vault": "1.10.2",
87
87
  "@aws-sdk/middleware-websocket": "^3.972.54",
88
88
  "@earendil-works/chord": "1.3.0",
89
89
  "@earendil-works/pi-ai": "1.3.0",