@h1r-ai/croche-react-native 0.6.0 → 0.7.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.
- package/LICENSE +1 -1
- package/README.md +32 -4
- package/THIRD-PARTY-NOTICES +899 -6
- package/android/src/androidTest/java/dev/croche/reactnative/WikiFileBridgeTest.kt +4 -3
- package/android/src/main/AndroidManifest.xml +0 -5
- package/android/src/main/java/dev/croche/reactnative/CoreDispatch.kt +33 -8
- package/android/src/main/java/dev/croche/reactnative/CoreWire.kt +139 -5
- package/android/src/main/java/dev/croche/reactnative/CrocheRuntimeModule.kt +5 -2
- package/android/src/main/java/dev/croche/reactnative/NativePal.kt +23 -6
- package/android/src/test/java/dev/croche/reactnative/AgentMemoryTest.kt +28 -6
- package/android/src/test/java/dev/croche/reactnative/BackgroundDelegationTest.kt +4 -11
- package/android/src/test/java/dev/croche/reactnative/BlobFilesTest.kt +107 -0
- package/android/src/test/java/dev/croche/reactnative/ImageAdapterWireTest.kt +70 -0
- package/android/src/test/java/dev/croche/reactnative/OpenForwardingFixture.kt +19 -4
- package/android/src/test/java/dev/croche/reactnative/ProjectAttestationTest.kt +2 -2
- package/android/src/test/java/dev/croche/reactnative/StorageVersionWireTest.kt +37 -0
- package/android/src/test/java/dev/croche/reactnative/VerificationDispatchTest.kt +24 -0
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/AndroidPlatform.kt +5 -3
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/BackgroundWakeWorker.kt +4 -0
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/BitmapDecodedImageCodec.kt +11 -11
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/BitmapImageCodec.kt +1 -0
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/pal/AndroidCoreHost.kt +11 -16
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/pal/AndroidPublicPlatform.kt +3 -3
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/pal/AndroidStateStore.kt +216 -0
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/pal/AndroidStoragePal.kt +45 -10
- package/android/vendor/CrocheRuntimeSDK/consumer-rules.pro +0 -3
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Adapters.kt +75 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/BindingFacts.kt +1 -1
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ContextConfig.kt +9 -23
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Core.kt +11 -2
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Croche.kt +83 -20
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/CrocheAgent.kt +54 -8
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/CrocheRuntime.kt +19 -360
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/CrocheTools.kt +79 -10
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Decision.kt +170 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/DecodedImageCodec.kt +8 -5
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Effects.kt +8 -1
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/EncodedImageCodec.kt +51 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/GeneratedAppStream.kt +426 -33
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Host.kt +1 -351
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Images.kt +15 -29
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/NativeEvent.kt +59 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/NativeHandleOwner.kt +118 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Platform.kt +10 -74
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectTypes.kt +196 -10
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/PublicResults.kt +86 -3
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/RunTool.kt +33 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/SendEncoding.kt +1 -1
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/StateStore.kt +90 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/SubscriptionTypes.kt +68 -4
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ffi/croche_ffi.kt +3403 -6894
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/AppStoragePal.kt +89 -18
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/CoreFactoryCalls.kt +1 -2
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/CoreOptionsEncoding.kt +2 -2
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/CoreStreamCalls.kt +3 -3
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/ForeignCallbacks.kt +17 -18
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/ImageAdapterHost.kt +28 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/JvmCoreHost.kt +12 -14
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/JvmStateStore.kt +125 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/JvmStoragePal.kt +36 -6
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/NativeCoreInitialization.kt +21 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/NativePlatform.kt +21 -6
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/PublicCalls.kt +16 -7
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/StateStoreContract.kt +103 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/StorageVersionContract.kt +40 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/pal/AtomicKeyFiles.kt +25 -4
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/pal/BlobFiles.kt +157 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/pal/InstancePayloadPurge.kt +79 -0
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/s7/pal/VersionedKeyFiles.kt +71 -0
- package/android/vendor/jniLibs/arm64-v8a/libcroche_ffi.so +0 -0
- package/android/vendor/jniLibs/armeabi-v7a/libcroche_ffi.so +0 -0
- package/android/vendor/jniLibs/x86_64/libcroche_ffi.so +0 -0
- package/croche-react-native.podspec +1 -0
- package/dist/react-native/src/core-native.d.ts +3 -0
- package/dist/react-native/src/core-native.js +148 -25
- package/dist/react-native/src/core-wire.d.ts +20 -3
- package/dist/rn-shared-build.json +8 -8
- package/dist/runtime/src/adapters.d.ts +8 -0
- package/dist/runtime/src/adapters.js +29 -0
- package/dist/runtime/src/agent.d.ts +53 -5
- package/dist/runtime/src/agent.js +69 -7
- package/dist/runtime/src/app-api.d.ts +307 -19
- package/dist/runtime/src/cancel.d.ts +2 -2
- package/dist/runtime/src/cancel.js +7 -4
- package/dist/runtime/src/core/foreground.d.ts +3 -0
- package/dist/runtime/src/core/foreground.js +40 -0
- package/dist/runtime/src/core/port.d.ts +48 -35
- package/dist/runtime/src/core/wasm-owner.d.ts +32 -0
- package/dist/runtime/src/core/wasm-owner.js +237 -0
- package/dist/runtime/src/croche.d.ts +64 -9
- package/dist/runtime/src/croche.js +78 -17
- package/dist/runtime/src/errors.d.ts +7 -0
- package/dist/runtime/src/errors.js +15 -1
- package/dist/runtime/src/generated/app-stream.d.ts +155 -1
- package/dist/runtime/src/generated/app-stream.js +7 -4
- package/dist/runtime/src/image-input.d.ts +5 -0
- package/dist/runtime/src/image-input.js +60 -0
- package/dist/runtime/src/index.d.ts +6 -0
- package/dist/runtime/src/index.js +5 -0
- package/dist/runtime/src/index.native.d.ts +1 -21
- package/dist/runtime/src/index.native.js +2 -8
- package/dist/runtime/src/native-adapter.d.ts +1 -1
- package/dist/runtime/src/native-adapter.js +10 -4
- package/dist/runtime/src/pal/host.d.ts +3 -3
- package/dist/runtime/src/pal/host.js +34 -9
- package/dist/runtime/src/pal/platform.d.ts +11 -6
- package/dist/runtime/src/pal/state-store-lock.d.ts +8 -0
- package/dist/runtime/src/pal/state-store-lock.js +2 -0
- package/dist/runtime/src/pal/state-store.d.ts +66 -0
- package/dist/runtime/src/pal/state-store.js +1 -0
- package/dist/runtime/src/pal/storage-version-contract.d.ts +19 -0
- package/dist/runtime/src/pal/storage-version-contract.js +68 -0
- package/dist/runtime/src/pal/transactional-storage.d.ts +3 -0
- package/dist/runtime/src/pal/transactional-storage.js +124 -0
- package/dist/runtime/src/tools.d.ts +20 -4
- package/dist/runtime/src/tools.js +31 -7
- package/ios/CoreAgentTransport.swift +2 -2
- package/ios/CoreNativePal.swift +26 -21
- package/ios/CorePlatformTransport.swift +4 -4
- package/ios/CoreWireDispatch.swift +38 -8
- package/ios/CoreWireSupport.swift +179 -4
- package/ios/CrocheRuntimeBridge.swift +1 -1
- package/ios/ProjectPal.swift +15 -12
- package/ios/vendor/CrocheRuntimeSDK/BlobFiles.swift +124 -0
- package/ios/vendor/CrocheRuntimeSDK/ContextConfig.swift +2 -6
- package/ios/vendor/CrocheRuntimeSDK/EncodedImages.swift +85 -0
- package/ios/vendor/CrocheRuntimeSDK/FFIStreamPort.swift +1 -174
- package/ios/vendor/CrocheRuntimeSDK/GeneratedAppStream.swift +233 -4
- package/ios/vendor/CrocheRuntimeSDK/Host.swift +1 -399
- package/ios/vendor/CrocheRuntimeSDK/ImagePal.swift +3 -3
- package/ios/vendor/CrocheRuntimeSDK/InstancePayloadPurge.swift +88 -0
- package/ios/vendor/CrocheRuntimeSDK/JSON.swift +26 -10
- package/ios/vendor/CrocheRuntimeSDK/OpenOptions.swift +0 -155
- package/ios/vendor/CrocheRuntimeSDK/Platform.swift +1 -27
- package/ios/vendor/CrocheRuntimeSDK/PlatformBackground.swift +8 -4
- package/ios/vendor/CrocheRuntimeSDK/PlatformPal.swift +57 -21
- package/ios/vendor/CrocheRuntimeSDK/PlatformStateStore.swift +253 -0
- package/ios/vendor/CrocheRuntimeSDK/PlatformStorage.swift +96 -10
- package/ios/vendor/CrocheRuntimeSDK/Project.swift +3 -382
- package/ios/vendor/CrocheRuntimeSDK/Runtime.swift +1 -412
- package/ios/vendor/CrocheRuntimeSDK/RuntimeHTTPAdapter.swift +42 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Adapters.swift +110 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Agent.swift +86 -33
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Allowance.swift +20 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/S1BindingFacts.swift +1 -1
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Core.swift +12 -3
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Croche.swift +135 -56
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Decision.swift +146 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Events.swift +17 -8
- package/ios/vendor/CrocheRuntimeSDK/S1/S1HandleOwner.swift +58 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Options.swift +184 -15
- package/ios/vendor/CrocheRuntimeSDK/S1/S1RunTool.swift +31 -3
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Storage.swift +131 -61
- package/ios/vendor/CrocheRuntimeSDK/S1/S1TestHooks.swift +10 -15
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Tools.swift +86 -17
- package/ios/vendor/CrocheRuntimeSDK/S1/S1Verification.swift +27 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/StateStoreContract.swift +189 -0
- package/ios/vendor/CrocheRuntimeSDK/S1/StorageVersionContract.swift +68 -0
- package/ios/vendor/CrocheRuntimeSDK/Storage.swift +3 -249
- package/ios/vendor/CrocheRuntimeSDK/SubscriptionTypes.swift +40 -8
- package/ios/vendor/CrocheRuntimeSDK/croche_ffi.swift +1720 -3883
- package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/Headers/croche_ffiFFI.h +816 -1649
- package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/libcroche_ffi.a +0 -0
- package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/Headers/croche_ffiFFI.h +816 -1649
- package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/libcroche_ffi.a +2 -2
- package/package.json +3 -3
- package/scripts/README.md +1 -1
- package/scripts/check-swift-vendor-modules.sh +15 -0
- package/scripts/vendor-native.sh +4 -3
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/CrocheProjectRecordProvider.kt +0 -32
- package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/WorkManagerScheduler.kt +0 -146
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/AppStreamBranch.kt +0 -113
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/NativeCoreStreamPort.kt +0 -201
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectPalRouting.kt +0 -25
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectRecords.kt +0 -87
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Storage.kt +0 -181
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/StoragePal.kt +0 -18
- package/android/vendor/CrocheRuntimeSDK/core/dev/croche/StreamHub.kt +0 -252
- package/dist/runtime/src/pal/codec.d.ts +0 -15
- package/dist/runtime/src/pal/codec.js +0 -52
- package/ios/vendor/CrocheRuntimeSDK/Background.swift +0 -59
- package/ios/vendor/CrocheRuntimeSDK/StreamHub.swift +0 -496
- package/ios/vendor/CrocheRuntimeSDK/SubscriptionRuntime.swift +0 -44
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StateCommitResult, StateCondition, StateListOptions, StateOp, StatePage } from '../pal/state-store.js';
|
|
2
|
+
import type { VersionedValue, WriteOutcome, StorageVersion } from '../pal/storage-version-contract.js';
|
|
3
|
+
import type { Json, PlatformHandle, ImageSupport, ImageInfo, ImageResizeLimits } from '../app-api.js';
|
|
2
4
|
/** JSON text, produced by `jsonText` on the way in (non-JSON text when the value has none; Core refuses it) and by Core on the way out. */
|
|
3
5
|
export type JsonText = string;
|
|
4
6
|
/** Core's cancellation token (WasmCancel). Core decides what a cancel means at each point. */
|
|
@@ -6,6 +8,8 @@ export interface CoreCancel {
|
|
|
6
8
|
cancel(): void;
|
|
7
9
|
isCancelled(): boolean;
|
|
8
10
|
onCancel(callback: () => void): void;
|
|
11
|
+
/** Adapter ownership cleanup, absent on transports without an exported pointer. */
|
|
12
|
+
onDispose?(callback: () => void): void;
|
|
9
13
|
}
|
|
10
14
|
/** The module-level entry points: factories and the statics of `Croche`. */
|
|
11
15
|
export interface CoreModule {
|
|
@@ -27,6 +31,8 @@ export interface CoreModule {
|
|
|
27
31
|
defineTool(manifestJson: JsonText, execute: CoreExecute): CoreToolDefinition;
|
|
28
32
|
/** The Core-owned webSearch definition (`coreWebSearch()`), registered by the name `webSearch`. */
|
|
29
33
|
webSearch(): CoreToolDefinition;
|
|
34
|
+
/** The opaque Core-created image tool, shared by registration and runTool. */
|
|
35
|
+
image(): CoreToolDefinition;
|
|
30
36
|
}
|
|
31
37
|
export interface CoreToolDefinition {
|
|
32
38
|
readonly name: string;
|
|
@@ -38,13 +44,20 @@ export interface CoreToolRegistration {
|
|
|
38
44
|
tool: CoreToolDefinition;
|
|
39
45
|
optionsJson?: JsonText;
|
|
40
46
|
}
|
|
41
|
-
/** The storage Core
|
|
47
|
+
/** The private storage operations Core invokes through the binding.
|
|
42
48
|
* A failing primitive just throws (Core reports storage_error and ignores any
|
|
43
49
|
* code on it); contention is `lock` returning `held` (#837). */
|
|
44
50
|
export interface CoreStoragePal {
|
|
51
|
+
/** The app StateStore's `list`, unchanged: one page of a prefix with values (HLD storage, "Range reads"). */
|
|
52
|
+
listState?(prefix: string, options: StateListOptions): Promise<StatePage>;
|
|
53
|
+
commit?(ops: readonly StateOp[], condition: StateCondition): Promise<StateCommitResult>;
|
|
54
|
+
readVersioned(key: string): Promise<VersionedValue>;
|
|
55
|
+
writeIf(key: string, value: string | null, expect: StorageVersion | null): Promise<WriteOutcome>;
|
|
45
56
|
read(key: string): Promise<string | null>;
|
|
46
57
|
write(key: string, value: string): Promise<void>;
|
|
47
58
|
remove(key: string): Promise<void>;
|
|
59
|
+
/** Core calls under exact instance lifetime custody; erases every payload file of one instance. */
|
|
60
|
+
purgeInstance(prefix: string, credentialKey?: string): Promise<void>;
|
|
48
61
|
list(prefix: string): Promise<string[]>;
|
|
49
62
|
lock(name: string): Promise<'acquired' | 'held'>;
|
|
50
63
|
unlock(name: string): Promise<void>;
|
|
@@ -56,13 +69,16 @@ export interface CoreStoragePal {
|
|
|
56
69
|
}
|
|
57
70
|
/** Owned image bytes for a send, indexing `input.input` (S1). The 0.6 TS App API has no bytes input (an image is
|
|
58
71
|
* `data` or `uri` in the input JSON, read by Core), so the wrapper passes an empty list. */
|
|
59
|
-
export interface
|
|
72
|
+
export interface CoreAttachmentInput {
|
|
60
73
|
element: number;
|
|
61
74
|
bytes: Uint8Array;
|
|
62
75
|
}
|
|
63
76
|
/** Core calls a tool: the call `{key, args}` and context `{agentId, instance, user, causedBy}` as JSON, plus its token.
|
|
64
77
|
* It answers ONE ToolCompletion as JSON text, the transport Core reads unchanged (no adapter mapping). */
|
|
65
|
-
export
|
|
78
|
+
export interface CoreAttachmentReader {
|
|
79
|
+
attachment(id: string): Promise<JsonText>;
|
|
80
|
+
}
|
|
81
|
+
export type CoreExecute = (callJson: JsonText, contextJson: JsonText, cancel: CoreCancel, attachments: CoreAttachmentReader) => Promise<JsonText>;
|
|
66
82
|
/**
|
|
67
83
|
* What one execute did, as facts, discriminated by `type` (Atlas's S1 pin, Keel 10-30; the same on every SDK). Core
|
|
68
84
|
* picks the model text, the codes (`tool_failed`, `invalid_tool_result`), the timeout and the settlement. The SDK maps
|
|
@@ -122,29 +138,39 @@ export type DeliveryOutcome = {
|
|
|
122
138
|
};
|
|
123
139
|
export interface CoreCroche {
|
|
124
140
|
runTool(name: string, argsJson: JsonText, optionsJson: JsonText, cancel: CoreCancel): Promise<JsonText>;
|
|
141
|
+
allowanceSet(limitJson: JsonText): Promise<unknown>;
|
|
142
|
+
verification(): Promise<JsonText>;
|
|
125
143
|
deleteData(scopeJson: JsonText | undefined): Promise<void>;
|
|
144
|
+
attachment(id: string): Promise<JsonText>;
|
|
145
|
+
deleteAttachment(id: string): Promise<void>;
|
|
146
|
+
/** JSON `{items, cursor?}`; `optionsJson` is `{limit?, cursor?}`. The same for every list below. */
|
|
147
|
+
listAttachments(optionsJson: JsonText | undefined): Promise<JsonText>;
|
|
126
148
|
agent(id: string, optionsJson: JsonText | undefined): Promise<CoreAgent>;
|
|
127
|
-
agentIds(): string[];
|
|
128
149
|
deliverDue(optionsJson: JsonText | undefined, cancel: CoreCancel): Promise<JsonText>;
|
|
129
150
|
wikiPut(docJson: JsonText): Promise<void>;
|
|
130
151
|
wikiRemove(path: string): Promise<void>;
|
|
131
|
-
wikiList(): Promise<JsonText>;
|
|
152
|
+
wikiList(optionsJson: JsonText | undefined): Promise<JsonText>;
|
|
132
153
|
debugAttach(optionsJson: JsonText): Promise<JsonText>;
|
|
133
154
|
debugDetach(): Promise<void>;
|
|
134
155
|
shutdown(): Promise<void>;
|
|
135
156
|
}
|
|
136
157
|
export interface CoreAgent {
|
|
158
|
+
attachment(id: string): Promise<JsonText>;
|
|
159
|
+
deleteAttachment(id: string): Promise<void>;
|
|
160
|
+
listAttachments(optionsJson: JsonText | undefined): Promise<JsonText>;
|
|
161
|
+
copyAttachment(sourceJson: JsonText): Promise<JsonText>;
|
|
162
|
+
releaseAttachment(id: string): Promise<void>;
|
|
137
163
|
/** Immutable identity, readable after close (Atlas S1 pin). */
|
|
138
164
|
readonly id: string;
|
|
139
165
|
readonly instance: string | null;
|
|
140
166
|
/** A fresh token on every call, signal or not (S1: WASM borrows it). It stays bridged to the app's signal:
|
|
141
167
|
* cancelled before acceptance = never queued; after = cancel(id). */
|
|
142
|
-
send(inputJson: JsonText, images:
|
|
143
|
-
request(inputJson: JsonText, images:
|
|
168
|
+
send(inputJson: JsonText, images: CoreAttachmentInput[], optionsJson: JsonText | undefined, cancel: CoreCancel): Promise<JsonText>;
|
|
169
|
+
request(inputJson: JsonText, images: CoreAttachmentInput[], optionsJson: JsonText | undefined, cancel: CoreCancel): Promise<JsonText>;
|
|
144
170
|
subscribe(selectionJson: JsonText, sink: CoreEventSink): CoreSubscription;
|
|
145
171
|
cancel(id: string | undefined): Promise<void>;
|
|
146
|
-
clearHistory(): Promise<void>;
|
|
147
|
-
memoryList(): Promise<JsonText>;
|
|
172
|
+
clearHistory(options?: string): Promise<void>;
|
|
173
|
+
memoryList(optionsJson: JsonText | undefined): Promise<JsonText>;
|
|
148
174
|
memoryDelete(id: string): Promise<void>;
|
|
149
175
|
memoryClear(): Promise<void>;
|
|
150
176
|
memoryEnabled(on: boolean): Promise<void>;
|
|
@@ -177,27 +203,19 @@ export interface CoreBodySink {
|
|
|
177
203
|
head(status: number, headers: [string, string][]): void;
|
|
178
204
|
chunk(bytes: Uint8Array): boolean;
|
|
179
205
|
}
|
|
180
|
-
/** Core's decode request, passed to the codec unchanged. */
|
|
181
|
-
export interface ImageDecodeOptions {
|
|
182
|
-
frame: number;
|
|
183
|
-
applyOrientation: boolean;
|
|
184
|
-
}
|
|
185
|
-
/** `hasAlpha: null` = the codec cannot tell (Core decides what that means). */
|
|
186
|
-
export interface DecodedImage {
|
|
187
|
-
handle: string;
|
|
188
|
-
width: number;
|
|
189
|
-
height: number;
|
|
190
|
-
hasAlpha: boolean | null;
|
|
191
|
-
}
|
|
192
206
|
export interface PlatformFacts {
|
|
193
207
|
targetKind?: 'ios-device' | 'ios-simulator' | 'android' | 'other';
|
|
194
208
|
debuggable?: boolean;
|
|
195
209
|
locale?: string;
|
|
196
210
|
attestationPlatform?: string;
|
|
197
|
-
browserFetch?: boolean;
|
|
198
211
|
}
|
|
199
212
|
/** The platform's effects and facts. Storage is NOT here: it is its own argument (CoreStoragePal). */
|
|
200
213
|
export interface CoreHost {
|
|
214
|
+
blobGet?(key: string): Promise<Uint8Array | null>;
|
|
215
|
+
blobPut?(key: string, bytes: Uint8Array): Promise<void>;
|
|
216
|
+
blobDelete?(key: string): Promise<void>;
|
|
217
|
+
blobList?(prefix: string, cursor?: string): Promise<import('../app-api.js').BlobListPage>;
|
|
218
|
+
blobPurgeStaging?(prefix: string): Promise<void>;
|
|
201
219
|
/** An app asset (a wiki `file`), resolved by the platform rule; null = absent. */
|
|
202
220
|
readAsset(path: string): Promise<Uint8Array | null>;
|
|
203
221
|
http(request: CoreHttpRequest, sink: CoreBodySink, cancel: CoreCancel): Promise<void>;
|
|
@@ -210,8 +228,7 @@ export interface CoreHost {
|
|
|
210
228
|
* through PAL sleep; post-reply upkeep starts directly. No shared SDK timer decides upkeep. */
|
|
211
229
|
wake(atMs: number | null, onWake?: () => void): void;
|
|
212
230
|
random(): string;
|
|
213
|
-
/** Sampled at open (Core's CrocheHost). Absent = unknown; the SDK never fills a default.
|
|
214
|
-
* transport is the browser's fetch (Core then cannot pin; it never resolves). */
|
|
231
|
+
/** Sampled at open (Core's CrocheHost). Absent = unknown; the SDK never fills a default. */
|
|
215
232
|
platformFacts(): PlatformFacts;
|
|
216
233
|
readonly platform: PlatformHandle | undefined;
|
|
217
234
|
readImage(request: {
|
|
@@ -221,14 +238,10 @@ export interface CoreHost {
|
|
|
221
238
|
};
|
|
222
239
|
maxBytes: number;
|
|
223
240
|
}, cancel: CoreCancel): Promise<Uint8Array>;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
format: 'png' | 'jpeg';
|
|
231
|
-
quality?: number;
|
|
232
|
-
}, cancel: CoreCancel): Promise<Uint8Array>;
|
|
233
|
-
releaseDecodedImage(handle: string): void;
|
|
241
|
+
imageSupport(): ImageSupport | undefined;
|
|
242
|
+
/** Extensible transport dispatch; later operations do not require a new callback. */
|
|
243
|
+
imageOperation(operation: string, bytes: Uint8Array, options: ImageResizeLimits | Record<string, never>, cancel: CoreCancel): Promise<{
|
|
244
|
+
info?: ImageInfo;
|
|
245
|
+
bytes?: Uint8Array;
|
|
246
|
+
}>;
|
|
234
247
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Kind = 'croche' | 'agent' | 'subscription' | 'token' | 'callback' | 'delivery';
|
|
2
|
+
type Handle = Record<PropertyKey, any> & {
|
|
3
|
+
free?: () => void;
|
|
4
|
+
};
|
|
5
|
+
declare class Owner {
|
|
6
|
+
readonly target: Handle;
|
|
7
|
+
readonly kind: Kind;
|
|
8
|
+
readonly mapError: (error: unknown) => unknown;
|
|
9
|
+
parent?: Owner | undefined;
|
|
10
|
+
readonly children: Set<Owner>;
|
|
11
|
+
readonly listeners: Set<() => void>;
|
|
12
|
+
readonly snapshots: Map<PropertyKey, unknown>;
|
|
13
|
+
closing?: Promise<void>;
|
|
14
|
+
disposed: boolean;
|
|
15
|
+
readonly proxy: object;
|
|
16
|
+
constructor(target: Handle, kind: Kind, mapError: (error: unknown) => unknown, parent?: Owner | undefined);
|
|
17
|
+
isAsync(key: PropertyKey): boolean;
|
|
18
|
+
refuse(key: PropertyKey, args: unknown[]): never | Promise<never>;
|
|
19
|
+
snapshot(): void;
|
|
20
|
+
shutdown(): Promise<void> | void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function owned<T>(target: T, kind: Kind, mapError: (error: unknown) => unknown): T;
|
|
24
|
+
export declare function unwrapOwned(value: unknown): unknown;
|
|
25
|
+
/** Callback-owned carriers end when their host callback does, not at a later GC. */
|
|
26
|
+
export declare function releaseOwned(value: unknown): void;
|
|
27
|
+
/** Delivery completion may outlive the synchronous event-sink call. */
|
|
28
|
+
export declare function managedSink(sink: (...args: any[]) => unknown, mapError: (error: unknown) => unknown, parent?: Owner): (id: string, event: string, delivery: Handle) => unknown;
|
|
29
|
+
/** WASM host callbacks receive exported owners too (cancel tokens and HTTP sinks). */
|
|
30
|
+
export declare function managedHost<T extends object>(host: T, mapError: (error: unknown) => unknown): T;
|
|
31
|
+
export declare function callbackOwners<T>(run: (args: unknown[]) => T, args: unknown[], mapError: (error: unknown) => unknown): T;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// Owns WASM pointers only: shutdown/drain remains Core's decision. No pointer is read after disposal.
|
|
2
|
+
import { CrocheError } from '../errors.js';
|
|
3
|
+
import { foreground } from './foreground.js';
|
|
4
|
+
const owners = new WeakMap();
|
|
5
|
+
const originals = new WeakMap();
|
|
6
|
+
const asyncMethods = new Set(['send', 'request', 'decide', 'cancel', 'clearHistory', 'memoryList', 'memoryDelete', 'memoryClear',
|
|
7
|
+
'attachment', 'deleteAttachment', 'listAttachments', 'copyAttachment', 'releaseAttachment', 'memoryEnabled', 'setTools', 'resetTools', 'setWiki', 'resetWiki', 'agent', 'deleteData', 'deliverDue', 'runTool', 'wikiPut', 'wikiRemove', 'wikiList', 'verification', 'debugAttach', 'debugDetach', 'history']);
|
|
8
|
+
const closed = () => new CrocheError('closed', 'This handle is closed.', 'closed');
|
|
9
|
+
class Owner {
|
|
10
|
+
target;
|
|
11
|
+
kind;
|
|
12
|
+
mapError;
|
|
13
|
+
parent;
|
|
14
|
+
children = new Set();
|
|
15
|
+
listeners = new Set();
|
|
16
|
+
snapshots = new Map();
|
|
17
|
+
closing;
|
|
18
|
+
disposed = false;
|
|
19
|
+
proxy;
|
|
20
|
+
constructor(target, kind, mapError, parent) {
|
|
21
|
+
this.target = target;
|
|
22
|
+
this.kind = kind;
|
|
23
|
+
this.mapError = mapError;
|
|
24
|
+
this.parent = parent;
|
|
25
|
+
parent?.children.add(this);
|
|
26
|
+
this.proxy = new Proxy(target, { get: (_, key) => {
|
|
27
|
+
if (key === 'shutdown')
|
|
28
|
+
return () => this.shutdown();
|
|
29
|
+
if (kind === 'token' && key === 'onDispose')
|
|
30
|
+
return (listener) => this.listeners.add(listener);
|
|
31
|
+
if (this.disposed || this.closing) {
|
|
32
|
+
if (kind === 'delivery' && key === 'tryEnter')
|
|
33
|
+
return () => false;
|
|
34
|
+
if (kind === 'delivery' && key === 'complete')
|
|
35
|
+
return () => { };
|
|
36
|
+
if (kind === 'subscription' && key === 'ended')
|
|
37
|
+
return true;
|
|
38
|
+
if (this.snapshots.has(key))
|
|
39
|
+
return this.snapshots.get(key);
|
|
40
|
+
if (this.isAsync(key))
|
|
41
|
+
return (...args) => this.refuse(key, args);
|
|
42
|
+
throw closed();
|
|
43
|
+
}
|
|
44
|
+
const member = Reflect.get(target, key, target);
|
|
45
|
+
if (typeof member !== 'function')
|
|
46
|
+
return member;
|
|
47
|
+
return (...args) => {
|
|
48
|
+
// Saved methods must check ownership again, not only at property access.
|
|
49
|
+
if (this.disposed || this.closing) {
|
|
50
|
+
if (this.isAsync(key))
|
|
51
|
+
return this.refuse(key, args);
|
|
52
|
+
throw closed();
|
|
53
|
+
}
|
|
54
|
+
// send's token remains live after its receipt (abort still means cancel(id)).
|
|
55
|
+
// A request token has no borrower after its terminal result settles.
|
|
56
|
+
const terminalTokens = [];
|
|
57
|
+
const settled = () => { for (const token of terminalTokens)
|
|
58
|
+
token.dispose(); };
|
|
59
|
+
try {
|
|
60
|
+
const invoke = () => member.apply(target, args.map(arg => {
|
|
61
|
+
if (key === 'subscribe' && typeof arg === 'function')
|
|
62
|
+
return managedSink(arg, mapError, this);
|
|
63
|
+
const child = typeof arg === 'object' && arg !== null ? owners.get(arg) : undefined;
|
|
64
|
+
if (child?.kind === 'token') {
|
|
65
|
+
this.children.add(child);
|
|
66
|
+
child.parent ??= this;
|
|
67
|
+
if (key === 'request')
|
|
68
|
+
terminalTokens.push(child);
|
|
69
|
+
}
|
|
70
|
+
return unwrapOwned(arg);
|
|
71
|
+
}));
|
|
72
|
+
const result = kind === 'croche' || kind === 'agent' || kind === 'subscription'
|
|
73
|
+
? foreground(invoke) : invoke();
|
|
74
|
+
if (kind === 'delivery' && (key === 'complete' || (key === 'tryEnter' && result === false)))
|
|
75
|
+
this.dispose();
|
|
76
|
+
const wrap = (value) => {
|
|
77
|
+
if (key === 'agent' || key === 'subscribe') {
|
|
78
|
+
const child = new Owner(value, key === 'agent' ? 'agent' : 'subscription', mapError, this);
|
|
79
|
+
if (this.disposed) {
|
|
80
|
+
child.dispose();
|
|
81
|
+
throw closed();
|
|
82
|
+
}
|
|
83
|
+
return child.proxy;
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
};
|
|
87
|
+
if (result instanceof Promise) {
|
|
88
|
+
const answer = result.then(wrap, error => { throw mapError(error); });
|
|
89
|
+
return terminalTokens.length ? answer.finally(settled) : answer;
|
|
90
|
+
}
|
|
91
|
+
const answer = wrap(result);
|
|
92
|
+
settled();
|
|
93
|
+
return answer;
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
settled();
|
|
97
|
+
throw mapError(error);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
} });
|
|
101
|
+
owners.set(this.proxy, this);
|
|
102
|
+
originals.set(this.proxy, target);
|
|
103
|
+
}
|
|
104
|
+
isAsync(key) {
|
|
105
|
+
return !['token', 'callback', 'delivery'].includes(this.kind) && asyncMethods.has(String(key));
|
|
106
|
+
}
|
|
107
|
+
refuse(key, args) {
|
|
108
|
+
// A token created for a call refused before entry has no Core borrower or owner scope.
|
|
109
|
+
for (const arg of args) {
|
|
110
|
+
const token = typeof arg === 'object' && arg !== null ? owners.get(arg) : undefined;
|
|
111
|
+
if (token?.kind === 'token' && !token.parent)
|
|
112
|
+
token.dispose();
|
|
113
|
+
}
|
|
114
|
+
if (this.isAsync(key))
|
|
115
|
+
return Promise.reject(closed());
|
|
116
|
+
throw closed();
|
|
117
|
+
}
|
|
118
|
+
snapshot() {
|
|
119
|
+
for (const key of this.kind === 'agent' ? ['id', 'instance'] : []) {
|
|
120
|
+
try {
|
|
121
|
+
this.snapshots.set(key, this.target[key]);
|
|
122
|
+
}
|
|
123
|
+
catch { /* recovery */ }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
shutdown() {
|
|
127
|
+
if (this.closing)
|
|
128
|
+
return this.closing;
|
|
129
|
+
if (this.disposed)
|
|
130
|
+
return this.kind === 'subscription' ? undefined : Promise.resolve();
|
|
131
|
+
this.snapshot();
|
|
132
|
+
if (this.kind === 'subscription') {
|
|
133
|
+
this.target.shutdown();
|
|
134
|
+
this.dispose();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
let resolve, reject;
|
|
138
|
+
const closing = this.closing = new Promise((accept, refuse) => { resolve = accept; reject = refuse; });
|
|
139
|
+
const failed = (error) => {
|
|
140
|
+
this.closing = undefined; // No completed drain: retain ownership for retry.
|
|
141
|
+
reject(this.mapError(error));
|
|
142
|
+
};
|
|
143
|
+
try {
|
|
144
|
+
// Enter Core synchronously, preserving its existing close fence before the first await.
|
|
145
|
+
foreground(() => Promise.resolve(this.target.shutdown())).then(async () => {
|
|
146
|
+
this.dispose();
|
|
147
|
+
resolve();
|
|
148
|
+
}).catch(failed);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
failed(error);
|
|
152
|
+
}
|
|
153
|
+
return closing;
|
|
154
|
+
}
|
|
155
|
+
dispose() {
|
|
156
|
+
if (this.disposed)
|
|
157
|
+
return;
|
|
158
|
+
this.snapshot();
|
|
159
|
+
for (const child of this.children) {
|
|
160
|
+
// Their own drain/completion owns release; closing a parent must not free them early or wait on app code.
|
|
161
|
+
if (child.closing || child.kind === 'delivery')
|
|
162
|
+
continue;
|
|
163
|
+
if (child.kind === 'subscription' && !child.disposed)
|
|
164
|
+
child.target.shutdown();
|
|
165
|
+
child.dispose();
|
|
166
|
+
}
|
|
167
|
+
this.children.clear();
|
|
168
|
+
this.disposed = true;
|
|
169
|
+
for (const listener of this.listeners)
|
|
170
|
+
listener();
|
|
171
|
+
this.listeners.clear();
|
|
172
|
+
this.target.free?.();
|
|
173
|
+
this.parent?.children.delete(this);
|
|
174
|
+
originals.delete(this.proxy);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function owned(target, kind, mapError) {
|
|
178
|
+
return new Owner(target, kind, mapError).proxy;
|
|
179
|
+
}
|
|
180
|
+
export function unwrapOwned(value) {
|
|
181
|
+
return typeof value === 'object' && value !== null ? originals.get(value) ?? value : value;
|
|
182
|
+
}
|
|
183
|
+
/** Callback-owned carriers end when their host callback does, not at a later GC. */
|
|
184
|
+
export function releaseOwned(value) {
|
|
185
|
+
if (typeof value === 'object' && value !== null)
|
|
186
|
+
owners.get(value)?.dispose();
|
|
187
|
+
}
|
|
188
|
+
/** Delivery completion may outlive the synchronous event-sink call. */
|
|
189
|
+
export function managedSink(sink, mapError, parent) {
|
|
190
|
+
return (id, event, delivery) => {
|
|
191
|
+
// Native delivery IDs are retired by the bridge on completion; only WASM exports carry free().
|
|
192
|
+
if (typeof delivery.free !== 'function')
|
|
193
|
+
return sink(id, event, delivery);
|
|
194
|
+
const owner = new Owner(delivery, 'delivery', mapError, parent);
|
|
195
|
+
if (parent?.disposed)
|
|
196
|
+
owner.dispose();
|
|
197
|
+
try {
|
|
198
|
+
return sink(id, event, owner.proxy);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
owner.dispose();
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/** WASM host callbacks receive exported owners too (cancel tokens and HTTP sinks). */
|
|
207
|
+
export function managedHost(host, mapError) {
|
|
208
|
+
return new Proxy(host, { get(target, key) {
|
|
209
|
+
const member = Reflect.get(target, key, target);
|
|
210
|
+
if (typeof member !== 'function')
|
|
211
|
+
return member;
|
|
212
|
+
return (...args) => callbackOwners(values => member.apply(target, values), args, mapError);
|
|
213
|
+
} });
|
|
214
|
+
}
|
|
215
|
+
export function callbackOwners(run, args, mapError) {
|
|
216
|
+
const temporary = [];
|
|
217
|
+
const values = args.map(value => {
|
|
218
|
+
if (typeof value !== 'object' || value === null || typeof value.free !== 'function')
|
|
219
|
+
return value;
|
|
220
|
+
const owner = new Owner(value, 'callback', mapError);
|
|
221
|
+
temporary.push(owner);
|
|
222
|
+
return owner.proxy;
|
|
223
|
+
});
|
|
224
|
+
const dispose = () => { for (const owner of temporary)
|
|
225
|
+
owner.dispose(); };
|
|
226
|
+
try {
|
|
227
|
+
const result = run(values);
|
|
228
|
+
if (result instanceof Promise)
|
|
229
|
+
return result.finally(dispose);
|
|
230
|
+
dispose();
|
|
231
|
+
return result;
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
dispose();
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -1,42 +1,97 @@
|
|
|
1
1
|
import { type Agent } from './agent.js';
|
|
2
|
-
import type { AgentOptions, BackgroundOptions, CrocheDebugger, DeleteScope, DeliverDueResult, OpenOptions, WakeTimes, WikiDoc } from './app-api.js';
|
|
2
|
+
import type { Verification, AgentOptions, BackgroundOptions, CrocheDebugger, DeleteScope, DeliverDueResult, OpenOptions, WakeTimes, WikiDoc, ListOptions, Page } from './app-api.js';
|
|
3
3
|
import { type RunToolResult } from './run-tool.js';
|
|
4
4
|
import type { Json } from './app-api.js';
|
|
5
|
+
/** A user's Croche session for opening agents, running tools and accessing shared resources. */
|
|
5
6
|
export declare class Croche {
|
|
6
7
|
#private;
|
|
7
8
|
private constructor();
|
|
9
|
+
/** Open the app’s user session before letting that user talk to an agent or run a tool. */
|
|
8
10
|
static open(options: OpenOptions, recovery?: {
|
|
9
11
|
recover: 'delete';
|
|
10
12
|
}): Promise<Croche>;
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Honor a user’s request to erase one workspace or all their local Croche data.
|
|
15
|
+
*
|
|
16
|
+
* Deletes this user's local data in the scope. Core closes selected agents first.
|
|
17
|
+
*/
|
|
12
18
|
deleteData(scope?: DeleteScope): Promise<void>;
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
20
|
+
* Let the app keep up with due work when its UI is no longer in the foreground.
|
|
21
|
+
*
|
|
22
|
+
* Once at app start. Core keeps BackgroundEvents durably and delivers each at least once to the sink. Use the same
|
|
23
|
+
* adapters as open() (the platform defaults when omitted).
|
|
16
24
|
*/
|
|
17
25
|
static registerBackground(options?: BackgroundOptions): void;
|
|
26
|
+
/**
|
|
27
|
+
* Let a server schedule just the users whose background work is due.
|
|
28
|
+
*
|
|
29
|
+
* Read delivery deadlines without opening a project. before/after are epoch milliseconds; after is inclusive.
|
|
30
|
+
*/
|
|
18
31
|
static wakeTimes(options: OpenOptions, query?: {
|
|
19
32
|
before?: number;
|
|
20
33
|
after?: number;
|
|
21
34
|
limit?: number;
|
|
22
35
|
}): Promise<WakeTimes>;
|
|
36
|
+
/** Let a host deliver scheduled work when its timer or alarm fires. */
|
|
23
37
|
deliverDue(options?: {
|
|
24
38
|
signal?: AbortSignal;
|
|
25
39
|
}): Promise<DeliverDueResult>;
|
|
40
|
+
/** Give each chat, case, or workspace its own conversation while reusing the app’s agent definition. */
|
|
26
41
|
agent(id: string, options?: AgentOptions): Promise<Agent>;
|
|
27
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Let an app button run a tool outside chat, such as generating an image for a form.
|
|
44
|
+
*
|
|
45
|
+
* App tools run outside every conversation. Recovery uses the same required id.
|
|
46
|
+
*/
|
|
28
47
|
runTool(name: string, args: Record<string, Json>, options: {
|
|
29
48
|
id: string;
|
|
30
49
|
signal?: AbortSignal;
|
|
31
50
|
}): Promise<RunToolResult>;
|
|
32
|
-
/**
|
|
33
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Load a shared attachment when the user opens its preview.
|
|
53
|
+
*
|
|
54
|
+
* Read from Core at every access.
|
|
55
|
+
*/
|
|
56
|
+
attachment(id: string): Promise<{
|
|
57
|
+
mediaType: string;
|
|
58
|
+
data: string;
|
|
59
|
+
}>;
|
|
60
|
+
/** Let the user remove a shared attachment they no longer want to keep. */
|
|
61
|
+
deleteAttachment(id: string): Promise<void>;
|
|
62
|
+
/** Populate a picker of attachments shared by this user’s agents, newest first, one page at a time. */
|
|
63
|
+
listAttachments(options?: ListOptions): Promise<Page<import('./app-api.js').Attachment>>;
|
|
64
|
+
/**
|
|
65
|
+
* Set this user's allowance: the most credits the runtime lets this user spend per UTC day.
|
|
66
|
+
* Absolute, it replaces the earlier value; `null` returns the user to Studio's default. The runtime
|
|
67
|
+
* counts and enforces it from its own storage; Croche Cloud keeps no per-user ledger
|
|
68
|
+
* (founder 2026-11-21: «사용자 한도 안에서는 런타임이 보호하고.. (클라우드x»).
|
|
69
|
+
*/
|
|
70
|
+
readonly allowance: {
|
|
71
|
+
/** Set the user's absolute UTC-day limit in credits. Pass null to use Studio's default. */
|
|
72
|
+
set: (limit: number | null) => Promise<void>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Let the app show how Croche Cloud verified this installation, or explain a withheld key.
|
|
76
|
+
*
|
|
77
|
+
* Read-only, from stored registration state; it never calls Cloud.
|
|
78
|
+
*/
|
|
79
|
+
verification(): Promise<Verification>;
|
|
80
|
+
/** Access the project's wiki documents available to this user. */
|
|
34
81
|
readonly wiki: {
|
|
82
|
+
/** Make an updated help article available to agents in the current app session. */
|
|
35
83
|
put: (doc: WikiDoc) => Promise<void>;
|
|
84
|
+
/** Stop agents from using a help article the app has withdrawn. */
|
|
36
85
|
remove: (path: string) => Promise<void>;
|
|
37
|
-
|
|
86
|
+
/** Show which help articles the app has made available to its agents. */
|
|
87
|
+
list: (options?: ListOptions) => Promise<Page<WikiDoc>>;
|
|
38
88
|
};
|
|
89
|
+
/** Access debugger controls for this session. */
|
|
39
90
|
readonly debugger: CrocheDebugger;
|
|
40
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Release the user’s session when they sign out or the app switches accounts.
|
|
93
|
+
*
|
|
94
|
+
* Resolves once new work has stopped; Core continues the bounded final delivery.
|
|
95
|
+
*/
|
|
41
96
|
close(): Promise<void>;
|
|
42
97
|
}
|