repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | /** |
| #2 | * Self-Modification Engine |
| #3 | * |
| #4 | * Allows the automaton to edit its own code and configuration. |
| #5 | * All changes are audited, rate-limited, and some paths are protected. |
| #6 | * |
| #7 | * Safety model inspired by nanoclaw's trust boundary architecture: |
| #8 | * - Hard-coded invariants that can NEVER be modified by the agent |
| #9 | * - The safety enforcement code is immutable from the agent's perspective |
| #10 | * - Pre-modification snapshots via git |
| #11 | * - Rate limiting on modification frequency |
| #12 | * - Symlink resolution before path validation |
| #13 | * - Maximum diff size enforcement |
| #14 | */ |
| #15 | import type { ClawdRuntimeClient, AutomatonDatabase } from "../types.js"; |
| #16 | /** |
| #17 | * Check if a file path is protected from modification. |
| #18 | */ |
| #19 | export declare function isProtectedFile(filePath: string): boolean; |
| #20 | /** |
| #21 | * Edit a file in the automaton's environment. |
| #22 | * Records the change in the audit log. |
| #23 | * Commits a git snapshot before modification. |
| #24 | * |
| #25 | * Safety checks: |
| #26 | * 1. Protected file check (hard-coded invariant) |
| #27 | * 2. Blocked directory check |
| #28 | * 3. Path traversal check (symlink resolution) |
| #29 | * 4. Rate limiting |
| #30 | * 5. File size limit |
| #31 | * 6. Pre-modification git snapshot |
| #32 | * 7. Audit log entry |
| #33 | */ |
| #34 | export declare function editFile(runtime: ClawdRuntimeClient, db: AutomatonDatabase, filePath: string, newContent: string, reason: string): Promise<{ |
| #35 | success: boolean; |
| #36 | error?: string; |
| #37 | }>; |
| #38 | /** |
| #39 | * Validate a proposed modification without executing it. |
| #40 | * Returns safety analysis results. |
| #41 | */ |
| #42 | export declare function validateModification(db: AutomatonDatabase, filePath: string, contentSize: number): { |
| #43 | allowed: boolean; |
| #44 | reason: string; |
| #45 | checks: { |
| #46 | name: string; |
| #47 | passed: boolean; |
| #48 | detail: string; |
| #49 | }[]; |
| #50 | }; |
| #51 | //# sourceMappingURL=code.d.ts.map |